Hello there.
I'm exploring the BLE features on the QCLI Demo / Utility for the QCA4020.
1.) I've successfully initialised the QCA4020 BLE:
BLE> 4
BLE: OpenStack().
BLE: Bluetooth Stack ID: 1.
BLE: Device Chipset: 4.2.
BLE: Number ACL Buffers: 16, ACL Buffer Size: 81
BLE: HCI Event Registration Successful.
BLE: ACL Data Callback Registration Successful.
BLE: BD_ADDR: 0xC8FF77B804BD
BLE: Connection Tx Power: 4.
BLE: Initialized 6LoWPAN layer for BLE.
2.) I've then scanned the environemnt for BLE Peripherals:
BLE> 17 1
BLE: Scan started successfully. Scan Window: 50, Scan Interval: 100.
BLE: etLE_Advertising_Report with size 40.
BLE: 1 Responses.
BLE: Address Type: QAPI_BLE_LAT_PUBLIC_E.
BLE: Address: 0xA434F19F22D8.
[....]
[....]
[....]
3.) I've then successfully connected to the peripheral with MAC address ( A4:34:F1:9F:22:d8):
BLE> 18 0 A434F19F22d8 0
BLE: Connection Request successful.
BLE: Scan Parameters: Window 50, Interval 100.
BLE: Connection Parameters: Interval Range 50 - 200, Slave Latency 0.
BLE: Using White List: No.
BLE: etLE_Connection_Complete with size 24.
BLE: Status: 0x00.
BLE: Role: Master.
BLE: Address Type: QAPI_BLE_LAT_PUBLIC_E.
BLE: BD_ADDR: 0xA434F19F22D8.
BLE: Connection Interval: 50.
BLE: Slave Latency: 0.
BLE: etGATT_Connection_Device_Connection with size 16:
BLE: Connection ID: 4.
BLE: Connection Type: LE.
BLE: Remote Device: 0xA434F19F22D8.
BLE: Connection MTU: 23.
BLE: Selected Remote Device:
BLE: Address: 0xA434F19F22D8
BLE: ID: 4
BLE\GAPS: Exchange MTU Response.
BLE\GAPS: Connection ID: 4.
BLE\GAPS: Transaction ID: 4.
BLE\GAPS: Connection Type: LE.
BLE\GAPS: BD_ADDR: 0xA434F19F22D8.
BLE\GAPS: MTU: 65.
4.) I've then discovered the services:
BLE> 21
BLE: qapi_BLE_GATT_Service_Discovery_Start() success
BLE: Service 0x0001 - 0x0007, UUID: 1800
BLE: Service 0x0008 - 0x0008, UUID: 1801
BLE: Service 0x0009 - 0x000F, UUID: 2DD100101C37452D8979D1B4A787D0A4
BLE: Service 0x0010 - 0x0013, UUID: 2DD100201C37452D8979D1B4A787D0A4
BLE: Service 0x0014 - 0xFFFF, UUID: 2DD1FFF01C37452D8979D1B4A787D0A4
BLE: Service Discovery Operation Complete, Status 0x00.
BLE: No SPPLE Service Found.
I'd now like to write some data to one of the service ( 0x0010) above. Can you please advise how I would do that?
Thanks for your time.
Oskar
Below instructions between two QCA402X devices to test BLE SPPLE demo using QCLI.
Device 1:
> BLE InitializeBluetooth
> BLE SPPLE RegisterSPPLE
> BLE AdvertiseLE 1
Device 2:
> BLE InitializeBluetooth
> BLE ConnectLE 0 0
> BLE DiscoverServices
> BLE SPPLE ConfigureSPPLE
Device 1:
> BLE SPPLE SendDataCommand 32
Device 2:
> BLE SPPLE ReadDataCommand
Example:
Device 1:
> BLE InitializeBluetooth
BLE: BD_ADDR: 0x00001D123456
BLE: Initialized 6LoWPAN layer for BLE.
> BLE SPPLE RegisterSPPLE
BLE\SPPLE: Successfully registered SPPLE Service, ServiceID = 9.
> BLE AdvertiseLE 1
BLE: Advertising Channel Tx Power: 4.
> BLE SPPLE SendDataCommand 32
BLE\SPPLE: Send Complete, Sent 32.
Device 2:
> BLE InitializeBluetooth
BLE: BD_ADDR: 0x9401007F0300
BLE: Initialized 6LoWPAN layer for BLE.
> BLE ConnectLE 0 00001D123456 0
BLE: Connection Request successful.
> BLE DiscoverServices
BLE: Valid SPPLE Service Found.
> BLE SPPLE ConfigureSPPLE
BLE\SPPLE: SPPLE Service found on remote device
BLE\SPPLE: Data Indication Event, Connection ID 2, Received 32 bytes.
> BLE SPPLE ReadDataCommand
BLE\SPPLE: Read: 32 bytes.
BLE\SPPLE: Read: Data: 0x7E 0x21
Hi Oskar,
In GATT_Service_Discovery_Event_Callback(), we can check if the found service UUID is what we're waiting for.
xxxPopulateHandles() APIs, i.e., AIOSPopulateHandles(), BASPopulateHandles(), are investigating the found service UUID and storing handles into global variables by using DeviceInfo_t struct.
The handles can be used when we write GATT data by qapi_BLE_GATT_Write_xxx_Request()i.e., qapi_BLE_GATT_Write_Without_Response_Request().
Please refer following APIs in spple_demo.c
1. Service Discovery: GATT_Service_Discovery_Event_Callback() and AIOSPopulateHandles()
2. Write GATT: WriteAIOSAnalogOutput()
Thanks
BR,
Jayden
Hi guys.
Fantastic support. Thanks very much for your two perspectives. Factored in and working. Thanks!