Skip to content

Commit

Permalink
BLE Client now checks the adv address directly
Browse files Browse the repository at this point in the history
  • Loading branch information
doudar committed Mar 9, 2021
1 parent 928ce68 commit 20878eb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/BLE_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/BLE_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/BLE_Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 20878eb

Please sign in to comment.