I’m using the nRF5280, accessed using pc-ble-driver (API version 6), with SoftDevice S140
I want to efficiently get the list of services from a device, including the 128-bit UUIDs of services. I also want to efficiently get the list of characteristics from the device, including the 128-bit UUIDs of characteristics.
I see how to get these lists in the documentation and support cases such as the following: https://devzone.nordicsemi.com/f/nordic-q-a/17946/how-to-find-128-bit-uuid-services-with-sd_ble_gattc_primary_services_discover
However, for services/characteristics that have 128-bit UUIDs, these calls give me BLE_UUID_TYPE_UNKNOWN, and I’m supposed to do an extra call to sd_ble_gattc_read to get the value of the 128-bit UUID. This is inefficient, and slows down the service discovery.
The BLE trace shows that the 128-bit UUID is returned in the same packets that give the list of services/characteristics. Another chip/SDK (Bluegiga from Silicon Labs) gives me these 128-bit UUIDs without an extra call and an extra BLE round-trip to the remote device.
I’ll attach a trace “June25-1019AM-HFAGettingServices” from an Ellisys BLE analyzer. When viewing that trace, set the time to show UTC.
At around 14:18:08, my pc-ble-driver code gets the list of services by calling sd_ble_gattc_primary_services_discover, here is one line of that trace
Time | Item | Transmitter | Receiver | Payload | Status
2:18:09 PM.938 070 500 | ATT Read By Group Type Response Packet (UUID=89D3502B-0F36-433A-8EF4-C502AD55F8DC) | Slave: 7D:AF:0D:F7:6A:92 (Resolvable) | Master: FE:A9:29:44:18:66 (Static) | 20 bytes (46 00 51 00 DC F8 55 AD 02 C5 F4 8E 3A 43 36 0F 2B 50 D3 89) | OK
This packet gives service range from handle 70 (0x0046) to handle 81 (0x0051) with the UUID of handle 70 (0x0046) being 89D3502B-0F36-433A-8EF4-C502AD55F8DC
Because sd_ble_gattc_primary_services_discover doesn’t give me the 128-bit UUID from that packet, I need to use sd_ble_gattc_read, which makes another request to the remote device, which gives me that same UUID again
Time | Transmitter | Receiver | Item | Status | Payload | Time delta | Application
2:18:11 PM.187 671 500 | Slave: 7D:AF:0D:F7:6A:92 (Resolvable) | Master: FE:A9:29:44:18:66 (Static) | Start/Complete LE-U Packet | OK | 21 bytes (11 00 04 00 0B DC F8 55 AD 02 C5 F4 8E 3A 43 36 0F 2B 50 D3 89) | | ATT
These extra calls to sd_ble_gattc_read need to be done for any service/characteristic that has a 128-bit UUID. I want to speed up the time it takes to get services/characteristics, and this extra call to sd_ble_gattc_read is another place where pc-ble-driver is slower than my existing chip/SDK.
What can be done to make this faster, and eliminate these extra requests to the remote device?June25-1019AM-HFAGettingServices.btt