test

Dependencies:   nrf51-sdk

Dependents:   microbit-dal

Fork of nRF51822 by Lancaster University

Revision:
274:f82e0ecba699
Parent:
273:8ada9e8111a3
Child:
275:fd709cd8b1b2
--- a/btle/btle_discovery.cpp	Fri Jun 19 15:55:25 2015 +0100
+++ b/btle/btle_discovery.cpp	Fri Jun 19 15:55:25 2015 +0100
@@ -141,7 +141,7 @@
     if (cDiscoveryActive) {
         Gap::Handle_t startHandle = characteristics[characteristicIndex - 1].getValueHandle() + 1;
         Gap::Handle_t endHandle   = services[serviceIndex].getEndHandle();
-        resetDiscoveredCharacteristics();
+        resetDiscoveredCharacteristics(); /* Note: resetDiscoveredCharacteristics() must come after fetching start and end Handles. */
 
         if (startHandle < endHandle) {
             ble_gattc_handle_range_t handleRange = {
@@ -173,7 +173,7 @@
     }
     if (sDiscoveryActive && (numServices > 0) && (serviceIndex > 0)) {
         Gap::Handle_t endHandle = services[serviceIndex - 1].getEndHandle();
-        resetDiscoveredServices();
+        resetDiscoveredServices(); /* Note: resetDiscoveredServices() must come after fetching endHandle. */
 
         if (sd_ble_gattc_primary_services_discover(connHandle, endHandle, NULL) != NRF_SUCCESS) {
             terminateServiceDiscovery();