No changes
Fork of nRF51822 by
Diff: btle/btle_discovery.h
- Revision:
- 244:57c98fe71376
- Parent:
- 243:a966506d1e5b
- Child:
- 245:3abc61d38db3
--- a/btle/btle_discovery.h Fri Jun 19 15:55:21 2015 +0100 +++ b/btle/btle_discovery.h Fri Jun 19 15:55:22 2015 +0100 @@ -116,24 +116,12 @@ printf("end of service discovery\r\n"); } - void terminateCharacteristicDiscovery(void) { - cDiscoveryActive = false; - sDiscoveryActive = true; - serviceIndex++; /* Progress service index to keep discovery alive. */ - } - void resetDiscoveredServices(void) { numServices = 0; serviceIndex = 0; memset(services, 0, sizeof(DiscoveredService) * BLE_DB_DISCOVERY_MAX_SRV); } - void resetDiscoveredCharacteristics(void) { - numCharacteristics = 0; - characteristicIndex = 0; - memset(characteristics, 0, sizeof(DiscoveredCharacteristic) * BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV); - } - void serviceDiscoveryStarted(Gap::Handle_t connectionHandle) { connHandle = connectionHandle; resetDiscoveredServices(); @@ -142,14 +130,6 @@ } protected: - void characteristicDiscoveryStarted(Gap::Handle_t connectionHandle) { - connHandle = connectionHandle; - resetDiscoveredCharacteristics(); - cDiscoveryActive = true; - sDiscoveryActive = false; - } - -protected: ServiceDiscovery() { /* empty */ } @@ -174,8 +154,28 @@ void setupDiscoveredServices(const ble_gattc_evt_prim_srvc_disc_rsp_t *response); void setupDiscoveredCharacteristics(const ble_gattc_evt_char_disc_rsp_t *response); +public: + ble_error_t launchCharacteristicDiscovery(Gap::Handle_t connectionHandle, Gap::Handle_t startHandle, Gap::Handle_t endHandle); + + void terminateCharacteristicDiscovery(void) { + cDiscoveryActive = false; + sDiscoveryActive = true; + serviceIndex++; /* Progress service index to keep discovery alive. */ + } + private: - ble_error_t launchCharacteristicDiscovery(Gap::Handle_t connectionHandle, Gap::Handle_t startHandle, Gap::Handle_t endHandle); + void characteristicDiscoveryStarted(Gap::Handle_t connectionHandle) { + connHandle = connectionHandle; + resetDiscoveredCharacteristics(); + cDiscoveryActive = true; + sDiscoveryActive = false; + } + + void resetDiscoveredCharacteristics(void) { + numCharacteristics = 0; + characteristicIndex = 0; + memset(characteristics, 0, sizeof(DiscoveredCharacteristic) * BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV); + } public: void progressCharacteristicDiscovery() {