terminate discovery upon encountering errors.

This commit is contained in:
Rohit Grover 2015-05-06 16:11:36 +01:00
parent b57e1ec8e4
commit 3aae9f8ea6

View file

@ -154,7 +154,9 @@ NordicServiceDiscovery::progressCharacteristicDiscovery(void)
.start_handle = startHandle,
.end_handle = endHandle
};
printf("char discovery returned %u\r\n", sd_ble_gattc_characteristics_discover(connHandle, &handleRange));
if (sd_ble_gattc_characteristics_discover(connHandle, &handleRange) != NRF_SUCCESS) {
terminateCharacteristicDiscovery();
}
} else {
terminateCharacteristicDiscovery();
}
@ -179,7 +181,9 @@ NordicServiceDiscovery::progressServiceDiscovery(void)
Gap::Handle_t endHandle = services[serviceIndex - 1].endHandle;
resetDiscoveredServices();
printf("services discover returned %u\r\n", sd_ble_gattc_primary_services_discover(connHandle, endHandle, NULL));
if (sd_ble_gattc_primary_services_discover(connHandle, endHandle, NULL) != NRF_SUCCESS) {
terminateServiceDiscovery();
}
}
}