aa
Dependents: Peripheral_1_serial_copy Peripheral_1_serial 151006_1st_Scenario_normal
Fork of nRF51822 by
Diff: btle/btle_discovery.cpp
- Revision:
- 278:26e3f0ef1e14
- Parent:
- 277:91705df8495e
- Child:
- 279:6e5e79f1fb61
--- a/btle/btle_discovery.cpp Fri Jun 19 15:55:26 2015 +0100 +++ b/btle/btle_discovery.cpp Fri Jun 19 15:55:26 2015 +0100 @@ -21,7 +21,7 @@ #include "btle_discovery.h" #include "ble_err.h" -static NordicServiceDiscovery discoverySingleton; +static NordicServiceDiscovery sdSingleton; ble_error_t ServiceDiscovery::launch(Gap::Handle_t connectionHandle, @@ -30,16 +30,16 @@ const UUID &matchingServiceUUIDIn, const UUID &matchingCharacteristicUUIDIn) { - discoverySingleton.serviceCallback = sc; - discoverySingleton.characteristicCallback = cc; - discoverySingleton.matchingServiceUUID = matchingServiceUUIDIn; - discoverySingleton.matchingCharacteristicUUID = matchingCharacteristicUUIDIn; + sdSingleton.serviceCallback = sc; + sdSingleton.characteristicCallback = cc; + sdSingleton.matchingServiceUUID = matchingServiceUUIDIn; + sdSingleton.matchingCharacteristicUUID = matchingCharacteristicUUIDIn; - discoverySingleton.serviceDiscoveryStarted(connectionHandle); + sdSingleton.serviceDiscoveryStarted(connectionHandle); uint32_t rc; if ((rc = sd_ble_gattc_primary_services_discover(connectionHandle, NordicServiceDiscovery::SRV_DISC_START_HANDLE, NULL)) != NRF_SUCCESS) { - discoverySingleton.terminate(); + sdSingleton.terminate(); switch (rc) { case NRF_ERROR_INVALID_PARAM: case BLE_ERROR_INVALID_CONN_HANDLE: @@ -58,7 +58,7 @@ void ServiceDiscovery::terminate(void) { - discoverySingleton.terminateServiceDiscovery(); + sdSingleton.terminateServiceDiscovery(); } ble_error_t @@ -66,7 +66,7 @@ Gap::Handle_t startHandle, Gap::Handle_t endHandle) { - discoverySingleton.characteristicDiscoveryStarted(connectionHandle); + sdSingleton.characteristicDiscoveryStarted(connectionHandle); ble_gattc_handle_range_t handleRange = { .start_handle = startHandle, @@ -74,7 +74,7 @@ }; uint32_t rc; if ((rc = sd_ble_gattc_characteristics_discover(connectionHandle, &handleRange)) != NRF_SUCCESS) { - discoverySingleton.terminateCharacteristicDiscovery(); + sdSingleton.terminateCharacteristicDiscovery(); switch (rc) { case BLE_ERROR_INVALID_CONN_HANDLE: case NRF_ERROR_INVALID_ADDR: @@ -199,12 +199,12 @@ case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: switch (p_ble_evt->evt.gattc_evt.gatt_status) { case BLE_GATT_STATUS_SUCCESS: - discoverySingleton.setupDiscoveredServices(&p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp); + sdSingleton.setupDiscoveredServices(&p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp); break; case BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND: default: - discoverySingleton.terminate(); + sdSingleton.terminate(); break; } break; @@ -212,17 +212,17 @@ case BLE_GATTC_EVT_CHAR_DISC_RSP: switch (p_ble_evt->evt.gattc_evt.gatt_status) { case BLE_GATT_STATUS_SUCCESS: - discoverySingleton.setupDiscoveredCharacteristics(&p_ble_evt->evt.gattc_evt.params.char_disc_rsp); + sdSingleton.setupDiscoveredCharacteristics(&p_ble_evt->evt.gattc_evt.params.char_disc_rsp); break; case BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND: default: - discoverySingleton.terminateCharacteristicDiscovery(); + sdSingleton.terminateCharacteristicDiscovery(); break; } break; } - discoverySingleton.progressCharacteristicDiscovery(); - discoverySingleton.progressServiceDiscovery(); + sdSingleton.progressCharacteristicDiscovery(); + sdSingleton.progressServiceDiscovery(); } \ No newline at end of file