@@ -701,8 +701,6 @@ void notifyCB(
701701 } else {
702702 Log.trace (F (" Callback process canceled by processLock" CR));
703703 }
704-
705- pBLERemoteCharacteristic->unsubscribe ();
706704}
707705
708706/* *
@@ -721,12 +719,10 @@ void BLEconnect() {
721719 BLEAddress sensorAddress (p->macAdr );
722720 if (!pClient->connect (sensorAddress)) {
723721 Log.notice (F (" Failed to find client: %s" CR), p->macAdr );
724- NimBLEDevice::deleteClient (pClient);
725722 } else {
726723 BLERemoteService* pRemoteService = pClient->getService (serviceUUID);
727724 if (!pRemoteService) {
728725 Log.notice (F (" Failed to find service UUID: %s" CR), serviceUUID.toString ().c_str ());
729- pClient->disconnect ();
730726 } else {
731727 Log.trace (F (" Found service: %s" CR), serviceUUID.toString ().c_str ());
732728 // Obtain a reference to the characteristic in the service of the remote BLE server.
@@ -735,21 +731,19 @@ void BLEconnect() {
735731 BLERemoteCharacteristic* pRemoteCharacteristic = pRemoteService->getCharacteristic (charUUID);
736732 if (!pRemoteCharacteristic) {
737733 Log.notice (F (" Failed to find characteristic UUID: %s" CR), charUUID.toString ().c_str ());
738- pClient->disconnect ();
739734 } else {
740735 if (pRemoteCharacteristic->canNotify ()) {
741736 Log.trace (F (" Registering notification" CR));
742737 pRemoteCharacteristic->subscribe (true , notifyCB);
743738 delay (BLE_CNCT_TIMEOUT);
744- pClient->disconnect ();
745739 } else {
746740 Log.notice (F (" Failed registering notification" CR));
747- pClient->disconnect ();
748741 }
749742 }
750743 }
751744 }
752745 }
746+ NimBLEDevice::deleteClient (pClient);
753747 }
754748 }
755749 Log.notice (F (" BLE Connect end" CR));
0 commit comments