Remove unsubscribe and disconnect calls in BLEconnect. (#948)
These calls were unecessary as the client object swill be deleted when finished with the connection.
This commit is contained in:
1 parent
c82f6cadb6
commit
4706d75adc
1 file changed
+1
-7
+1
-7
@@ -701,8 +701,6 @@ void notifyCB(
|
|||||||
} else {
|
} else {
|
||||||
Log.trace(F("Callback process canceled by processLock" CR));
|
Log.trace(F("Callback process canceled by processLock" CR));
|
||||||
}
|
}
|
||||||
|
|
||||||
pBLERemoteCharacteristic->unsubscribe();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -721,12 +719,10 @@ void BLEconnect() {
|
|||||||
BLEAddress sensorAddress(p->macAdr);
|
BLEAddress sensorAddress(p->macAdr);
|
||||||
if (!pClient->connect(sensorAddress)) {
|
if (!pClient->connect(sensorAddress)) {
|
||||||
Log.notice(F("Failed to find client: %s" CR), p->macAdr);
|
Log.notice(F("Failed to find client: %s" CR), p->macAdr);
|
||||||
NimBLEDevice::deleteClient(pClient);
|
|
||||||
} else {
|
} else {
|
||||||
BLERemoteService* pRemoteService = pClient->getService(serviceUUID);
|
BLERemoteService* pRemoteService = pClient->getService(serviceUUID);
|
||||||
if (!pRemoteService) {
|
if (!pRemoteService) {
|
||||||
Log.notice(F("Failed to find service UUID: %s" CR), serviceUUID.toString().c_str());
|
Log.notice(F("Failed to find service UUID: %s" CR), serviceUUID.toString().c_str());
|
||||||
pClient->disconnect();
|
|
||||||
} else {
|
} else {
|
||||||
Log.trace(F("Found service: %s" CR), serviceUUID.toString().c_str());
|
Log.trace(F("Found service: %s" CR), serviceUUID.toString().c_str());
|
||||||
// Obtain a reference to the characteristic in the service of the remote BLE server.
|
// Obtain a reference to the characteristic in the service of the remote BLE server.
|
||||||
@@ -735,21 +731,19 @@ void BLEconnect() {
|
|||||||
BLERemoteCharacteristic* pRemoteCharacteristic = pRemoteService->getCharacteristic(charUUID);
|
BLERemoteCharacteristic* pRemoteCharacteristic = pRemoteService->getCharacteristic(charUUID);
|
||||||
if (!pRemoteCharacteristic) {
|
if (!pRemoteCharacteristic) {
|
||||||
Log.notice(F("Failed to find characteristic UUID: %s" CR), charUUID.toString().c_str());
|
Log.notice(F("Failed to find characteristic UUID: %s" CR), charUUID.toString().c_str());
|
||||||
pClient->disconnect();
|
|
||||||
} else {
|
} else {
|
||||||
if (pRemoteCharacteristic->canNotify()) {
|
if (pRemoteCharacteristic->canNotify()) {
|
||||||
Log.trace(F("Registering notification" CR));
|
Log.trace(F("Registering notification" CR));
|
||||||
pRemoteCharacteristic->subscribe(true, notifyCB);
|
pRemoteCharacteristic->subscribe(true, notifyCB);
|
||||||
delay(BLE_CNCT_TIMEOUT);
|
delay(BLE_CNCT_TIMEOUT);
|
||||||
pClient->disconnect();
|
|
||||||
} else {
|
} else {
|
||||||
Log.notice(F("Failed registering notification" CR));
|
Log.notice(F("Failed registering notification" CR));
|
||||||
pClient->disconnect();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
NimBLEDevice::deleteClient(pClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.notice(F("BLE Connect end" CR));
|
Log.notice(F("BLE Connect end" CR));
|
||||||
|
|||||||
Reference in new issue
Block a user