account for the limitation on the number of [SC] we can handle at a time within setupDiscovered*()

This commit is contained in:
Rohit Grover 2015-05-01 11:44:29 +01:00
parent a5b5af4b92
commit 1aef33c9a8

View file

@ -101,6 +101,11 @@ struct DiscoveryStatus {
currSrvInd = 0;
srvCount = response->count;
/* Account for the limitation on the number of discovered services we can handle at a time. */
if (srvCount > BLE_DB_DISCOVERY_MAX_SRV) {
srvCount = BLE_DB_DISCOVERY_MAX_SRV;
}
for (unsigned serviceIndex = 0; serviceIndex < srvCount; serviceIndex++) {
services[serviceIndex].setup(response->services[serviceIndex].uuid.uuid,
response->services[serviceIndex].handle_range.start_handle,
@ -112,6 +117,11 @@ struct DiscoveryStatus {
currCharInd = 0;
charCount = response->count;
/* Account for the limitation on the number of discovered characteristics we can handle at a time. */
if (charCount > BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV) {
charCount = BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV;
}
for (unsigned charIndex = 0; charIndex < charCount; charIndex++) {
characteristics[charIndex].setup(response->chars[charIndex].uuid.uuid,
response->chars[charIndex].char_props,