merge versions of ServiceDiscovery::launch() into a single API.

This commit is contained in:
Rohit Grover 2015-05-21 15:05:25 +01:00
parent 3e58c43354
commit cb0daad7e9

View file

@ -24,11 +24,18 @@
static NordicServiceDiscovery discoverySingleton;
ble_error_t
ServiceDiscovery::launch(Gap::Handle_t connectionHandle, ServiceCallback_t sc, CharacteristicCallback_t cc)
ServiceDiscovery::launch(Gap::Handle_t connectionHandle,
ServiceCallback_t sc,
CharacteristicCallback_t cc,
UUID matchingServiceUUIDIn,
UUID matchingCharacteristicUUIDIn)
{
discoverySingleton.serviceCallback = sc;
discoverySingleton.characteristicCallback = cc;
discoverySingleton.matchingServiceUUID = matchingServiceUUIDIn;
discoverySingleton.matchingCharacteristicUUID = matchingCharacteristicUUIDIn;
discoverySingleton.serviceDiscoveryStarted(connectionHandle);
discoverySingleton.serviceCallback = sc;
discoverySingleton.characteristicCallback = cc;
uint32_t rc;
if ((rc = sd_ble_gattc_primary_services_discover(connectionHandle, NordicServiceDiscovery::SRV_DISC_START_HANDLE, NULL)) != NRF_SUCCESS) {
@ -48,19 +55,6 @@ ServiceDiscovery::launch(Gap::Handle_t connectionHandle, ServiceCallback_t sc, C
return BLE_ERROR_NONE;
}
ble_error_t
ServiceDiscovery::launch(Gap::Handle_t connectionHandle,
UUID matchingServiceUUIDIn,
ServiceCallback_t sc,
UUID matchingCharacteristicUUIDIn,
CharacteristicCallback_t cc)
{
discoverySingleton.matchingServiceUUID = matchingServiceUUIDIn;
discoverySingleton.matchingCharacteristicUUID = matchingCharacteristicUUIDIn;
return launch(connectionHandle, sc, cc);
}
void
ServiceDiscovery::terminate(void)
{