terminate service discovery upon reaching the end handle.
parent
4a2fd63867
commit
acb585e077
|
@ -210,8 +210,12 @@ NordicServiceDiscovery::progressServiceDiscovery(void)
|
|||
Gap::Handle_t endHandle = services[serviceIndex - 1].getEndHandle();
|
||||
resetDiscoveredServices(); /* Note: resetDiscoveredServices() must come after fetching endHandle. */
|
||||
|
||||
if (sd_ble_gattc_primary_services_discover(connHandle, endHandle, NULL) != NRF_SUCCESS) {
|
||||
if (endHandle == SRV_DISC_END_HANDLE) {
|
||||
terminateServiceDiscovery();
|
||||
} else {
|
||||
if (sd_ble_gattc_primary_services_discover(connHandle, endHandle, NULL) != NRF_SUCCESS) {
|
||||
terminateServiceDiscovery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ class NordicServiceDiscovery : public ServiceDiscovery
|
|||
{
|
||||
public:
|
||||
static const uint16_t SRV_DISC_START_HANDLE = 0x0001; /**< The start handle value used during service discovery. */
|
||||
static const uint16_t SRV_DISC_END_HANDLE = 0xFFFF; /**< The end handle value used during service discovery. */
|
||||
|
||||
private:
|
||||
static const unsigned BLE_DB_DISCOVERY_MAX_SRV = 4; /**< Maximum number of services we can retain information for after a single discovery. */
|
||||
|
|
Loading…
Reference in New Issue