From 20878eb7fcbfc0408df81767eb8e9ecbde8470c3 Mon Sep 17 00:00:00 2001 From: doudar Date: Tue, 9 Mar 2021 10:16:42 -0600 Subject: [PATCH] BLE Client now checks the adv address directly --- src/BLE_Client.cpp | 1 + src/BLE_Common.cpp | 4 ++-- src/BLE_Server.cpp | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BLE_Client.cpp b/src/BLE_Client.cpp index 306b7167..8cf5a787 100644 --- a/src/BLE_Client.cpp +++ b/src/BLE_Client.cpp @@ -205,6 +205,7 @@ bool SpinBLEClient::connectToServer() pRemoteCharacteristic->subscribe(true, nullptr, true); debugDirector("Found " + String(pRemoteCharacteristic->getUUID().toString().c_str()) + " on reconnect."); reconnectTries = MAX_RECONNECT_TRIES; + //VV Is this really needed? Shouldn't it just carry over from the previous connection? VV spinBLEClient.myBLEDevices[device_number].set(myDevice, pClient->getConnId(), serviceUUID, charUUID); spinBLEClient.myBLEDevices[device_number].doConnect = false; diff --git a/src/BLE_Common.cpp b/src/BLE_Common.cpp index 7e69adc2..c0fbd398 100644 --- a/src/BLE_Common.cpp +++ b/src/BLE_Common.cpp @@ -30,9 +30,9 @@ void BLECommunications(void *pvParameters) myAdvertisedBLEDevice myAdvertisedDevice = spinBLEClient.myBLEDevices[x]; if ((myAdvertisedDevice.connectedClientID != BLE_HS_CONN_HANDLE_NONE) && (myAdvertisedDevice.doConnect == false)) //client must not be in connection process { - if (NimBLEDevice::getClientByPeerAddress(myAdvertisedDevice.peerAddress)) //nullptr check + if (NimBLEDevice::getClientByPeerAddress(myAdvertisedDevice.advertisedDevice->getAddress())) //nullptr check { - BLEClient *pClient = NimBLEDevice::getClientByPeerAddress(myAdvertisedDevice.peerAddress); + BLEClient *pClient = NimBLEDevice::getClientByPeerAddress(myAdvertisedDevice.advertisedDevice->getAddress()); if ((myAdvertisedDevice.serviceUUID != BLEUUID((uint16_t)0x0000)) && (pClient->isConnected())) //Client connected with a valid UUID registered { //Write the recieved data to the Debug Director diff --git a/src/BLE_Server.cpp b/src/BLE_Server.cpp index 39024f46..ca733d85 100644 --- a/src/BLE_Server.cpp +++ b/src/BLE_Server.cpp @@ -237,7 +237,6 @@ void updateIndoorBikeDataChar() ftmsIndoorBikeData[7] = (uint8_t)(watts >> 8); // power value, constrained to avoid negative values, although the specification allows for a sint16 ftmsIndoorBikeData[8] = (uint8_t)hr; fitnessMachineIndoorBikeData->setValue(ftmsIndoorBikeData, 9); - fitnessMachineFeature->notify(); fitnessMachineIndoorBikeData->notify(); } //^^Using the New Way of setting Bytes.