Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
Diff: btle/btle_discovery.cpp
- Revision:
- 276:ae6e5129b395
- Parent:
- 275:fd709cd8b1b2
- Child:
- 277:91705df8495e
--- 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 @@ -130,6 +130,7 @@ void NordicServiceDiscovery::progressCharacteristicDiscovery(void) { + /* Iterate through the previously discovered characteristics cached in characteristics[]. */ while (cDiscoveryActive && (characteristicIndex < numCharacteristics)) { if (characteristicCallback) { characteristicCallback(characteristics[characteristicIndex]); @@ -138,7 +139,9 @@ characteristicIndex++; } + /* Relaunch discovery of new characteristics beyond the last entry cached in characteristics[]. */ if (cDiscoveryActive) { + /* Determine the ending handle of the last cached characteristic. */ Gap::Handle_t startHandle = characteristics[characteristicIndex - 1].getValueHandle() + 1; Gap::Handle_t endHandle = services[serviceIndex].getEndHandle(); resetDiscoveredCharacteristics(); /* Note: resetDiscoveredCharacteristics() must come after fetching start and end Handles. */ @@ -160,6 +163,7 @@ void NordicServiceDiscovery::progressServiceDiscovery(void) { + /* Iterate through the previously discovered services cached in services[]. */ while (sDiscoveryActive && (serviceIndex < numServices)) { if (serviceCallback) { serviceCallback(services[serviceIndex]); @@ -171,7 +175,10 @@ serviceIndex++; /* Progress service index to keep discovery alive. */ } } + + /* Relaunch discovery of new services beyond the last entry cached in services[]. */ if (sDiscoveryActive && (numServices > 0) && (serviceIndex > 0)) { + /* Determine the ending handle of the last cached service. */ Gap::Handle_t endHandle = services[serviceIndex - 1].getEndHandle(); resetDiscoveredServices(); /* Note: resetDiscoveredServices() must come after fetching endHandle. */