NimBLE-Arduino
NimBLE-Arduino copied to clipboard
BLE Server, when Whitelist is active device cannot be seen or connected to
Hi @h2zero and thanks for this amazing lib. I have the following code:
void BluetoothController::addBondedDevicesToWhitelist()
{
const auto numberOfBondedDevices = NimBLEDevice::getNumBonds();
for(auto i = 0U; i < numberOfBondedDevices; ++i)
{
std::cout << "Adding bonded ble client with address: " << NimBLEDevice::getBondedAddress(i) << " to whitelist." << std::endl;
NimBLEDevice::whiteListAdd(NimBLEDevice::getBondedAddress(i));
std::cout << "Number of whitelisted devices: " << NimBLEDevice::getWhiteListCount() << std::endl;
}
}
Adding bonded ble client with address: 70704663222491 to whitelist.
This happens during initialization. You can assume I already have a bonded device. So that works fine.
Now, after that initialization, I want to restrict my server that it only is scanable and can be connected from whitelisted devices:
fPAdvertisingData->stop();
fPAdvertisingData->setScanFilter(true,true);
fPAdvertisingData->start();
After this called my device is visible but does not get a scan reply and cannot be connected from my bonded client.
Deactivating either the 1st or 2nd flag gives the correct results. So I am a bit confused now as to why this does not work, given that the bonded address and whitelisted address are one and the same, and also the same as the address of my client when it tries to connect.
I can provide with more debug info if necessary.
Sorry @sanastasiou, no idea why this wouldn't work. Are you still having this issue?