I'm working with a nrf51422/s110 dev kit on which I downloaded the Heart rate Monitoring sample project. On my PC, using a s130 dongle, I connect the device and wrote some code (based on Heart Rate Collector sample program) to discover all services/characteristics/descriptors of the BLE device.
When you request to disover services/characteristic/descriptors, only the first few one are retrieved, and you have to do a new request for the next ones.
For HRM device, here is the services/characteristics/descriptors hierarchy:
- Service 0x1800
- Characteristic 0x2A00
- Descriptor 0x2803
- Descriptor 0x2A00
- Characteristic 0x2A01
- Descriptor 0x2803
- Descriptor 0x2A01
- Characteristic 0x2A04
- Descriptor 0x2803
- Descriptor 0x2A04
- Characteristic 0x2A00
- Service 0x1801
- Characteristic 0x2A05
- Descriptor 0x2803
- Descriptor 0x2A05
- Descriptor 0x2902
- Characteristic 0x2A05
- Service 0x180D
- Characteristic 0x2A37
- Descriptor 0x2803
- Descriptor 0x2A37
- Descriptor 0x2902
- Characteristic 0x2A38
- Descriptor 0x2803
- Descriptor 0x2A38
- Characteristic 0x2A37
- Service 0x180F
- Characteristic 0x2A19
- Descriptor 0x2803
- Descriptor 0x2A19
- Descriptor 0x2902
- Characteristic 0x2A19
- Service 0x180A
- Characteristic 0x2A29
- Descriptor 0x2803
- Descriptor 0x2A29
- Characteristic 0x2A29
Here are the timings upon services/characteristic/descriptors discovery process:
- t0, Discovering primary services from handle 0x0001
- t0+110ms, Received service discovery response: UUID 0x1800, 0x1801, 0x180D (handles 0x0001 to 0x0011)
- t0+110ms, Discovering next primary services from handle 0x0012
- t0+220ms, Received service discovery response: UUID 0x180F, 0x180A (handles 0x0012 to 0xFFFF)
- t0+220ms, Discovering characteristics for service 0x1800 from 0x0001 to 0x0007
- t0+330ms, Found 3 new characteristic with handles: UUID 0x2A00 0x2A01 and 0x2A04 (handles 0x0003, 0x0005 and 0x0007)
- t0+330ms, Discovering descriptors for characteristic 0x2A00
- t0+440ms, Received descriptor discovery response: 0x2803 0x2A00
You see that, at this point, we only discovered:
- Service 0x1800
- Characteristic 0x2A00
- Descriptor 0x2803
- Descriptor 0x2A00
- Characteristic 0x2A00
And it took more than 400ms.
In the end, to discover the whole services/characteristic/descriptors hierarchy, it takes up to 2 seconds. For bigger devices (with much more complex services/characteristic/descriptors hierarchy), it can take up to 10 seconds, which is hardly acceptable.
Is there really no way to speed this up? Is there any setting that could be changed at the softdevice or firmware level)?
If not, the API should probably be reworked. When deploying the same code (C++) on an Android device (using Qt to access BLE), full services/characteristic/descriptors for HRM device takes only 700ms (3 times faster).