test

Dependencies:   nrf51-sdk

Dependents:   microbit-dal

Fork of nRF51822 by Lancaster University

Revision:
284:29fb6af6671d
Parent:
283:c4c2aeab86c3
Child:
285:55ac765bcc8d
diff -r c4c2aeab86c3 -r 29fb6af6671d btle/btle_discovery.cpp
--- a/btle/btle_discovery.cpp	Fri Jun 19 15:55:26 2015 +0100
+++ b/btle/btle_discovery.cpp	Fri Jun 19 15:55:26 2015 +0100
@@ -210,8 +210,12 @@
         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();
+            }
         }
     }
 }