h2zero / NimBLE-Arduino

A fork of the NimBLE library structured for compilation with Arduino, for use with ESP32, nRF5x.
https://h2zero.github.io/NimBLE-Arduino/
Apache License 2.0
711 stars 147 forks source link

Whitelist only calls onResult callback for max 12 devices #424

Closed devWaves closed 4 months ago

devWaves commented 2 years ago

Hi @h2zero . Me again. Once again thank you for the great work you have done with this library.

I am the primary developer of the project https://github.com/devWaves/SwitchBot-MQTT-BLE-ESP32 and it would be nowhere without your NimBLE-Arduino library

I am attempting to use whitelisting and it is successful, but the onResult callback for advertised devices is only matching on max 12 devices. I am able to add 14 devices to the whitelist (When I call NimBLEDevice::getWhiteListCount() it equals 14). But only 12 of the devices advertised data is being discovered and calling the onResult callback method

I am adding to the white list like this... (anAddr = MAC address) NimBLEDevice::whiteListAdd(NimBLEAddress(anAddr, 1));

and setting use whitelist mode like this... pScan->setFilterPolicy(BLE_HCI_SCAN_FILT_USE_WL);

thanks

h2zero commented 2 years ago

This may be a controller limitation, I'm not sure yet though. I will get back to you on this when I have a chance to look.

h2zero commented 2 years ago

Just to update this, 12 whitelist devices seems to be the hard limit for the esp32. https://github.com/espressif/esp-idf/issues/9205

devWaves commented 2 years ago

hey @h2zero thanks for looking into this. Since the issue isnt directly related to your code, feel free to close the issue. Might be good to keep open for other people to be aware though

Would be nice to have more than 12 devices in whitelist, so hopefully they make an update to the base library

h2zero commented 2 years ago

so hopefully they make an update to the base library

Doubtful to happen any time soon, it's set in the BLE controller closed source binary to this limit, in which they don't seem to keen to change parameters like this.