reorganized the division of helper functions between SD and NordicSD once again.
This commit is contained in:
parent
2f40cc9e7a
commit
993a277c07
1 changed files with 22 additions and 20 deletions
|
@ -116,12 +116,26 @@ public:
|
|||
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);
|
||||
}
|
||||
|
||||
protected:
|
||||
void resetDiscoveredCharacteristics(void) {
|
||||
numCharacteristics = 0;
|
||||
characteristicIndex = 0;
|
||||
memset(characteristics, 0, sizeof(DiscoveredCharacteristic) * BLE_DB_DISCOVERY_MAX_CHAR_PER_SRV);
|
||||
}
|
||||
|
||||
public:
|
||||
void serviceDiscoveryStarted(Gap::Handle_t connectionHandle) {
|
||||
connHandle = connectionHandle;
|
||||
resetDiscoveredServices();
|
||||
|
@ -129,6 +143,14 @@ public:
|
|||
cDiscoveryActive = false;
|
||||
}
|
||||
|
||||
protected:
|
||||
void characteristicDiscoveryStarted(Gap::Handle_t connectionHandle) {
|
||||
connHandle = connectionHandle;
|
||||
resetDiscoveredCharacteristics();
|
||||
cDiscoveryActive = true;
|
||||
sDiscoveryActive = false;
|
||||
}
|
||||
|
||||
protected:
|
||||
ServiceDiscovery() {
|
||||
/* empty */
|
||||
|
@ -157,26 +179,6 @@ public:
|
|||
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:
|
||||
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() {
|
||||
while (cDiscoveryActive && (characteristicIndex < numCharacteristics)) {
|
||||
|
|
Loading…
Reference in a new issue