-
-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Behavior differs from default BLE library during BLE scan when passive mode is set #22
Comments
Yes I was never very happy with this code, but seemed necessary at the time because NimBLE will trigger the callback for the advertisement and the scan response, so the callback would be called twice when active scanning. This was a workaround to wait until all the data was available before calling the callback. |
Thinking about this - of the three devices I'm trying to pick up, the two that aren't being picked up with this filter are the two that have advType of That said - would it make sense to check the advType and return if it is Non-Connectable if the scan is active?
The first two devices in the log above were the two that weren't being picked up when the scan was set as active, the last (the connectable one) is the one that was being picked up. |
Yes this should be changed for sure, I had thought about this before but didn't get around to working on it. Should work if this line was changed to
If you'd like to try that and let me know I'd appreciate it. |
That worked! PR incoming. :) |
Closed with the merge of #24 |
I had an issue earlier where a subset of BLE iBeacon devices that were showing up in the original ESP32 were not being picked up by my callback when using NimBLE.
From digging through the code, it appears that behavior differs between the two libraries when
BLEScan->setActiveScan()
is settrue
thereby disabling passive mode. In the default library the callback still gets triggered regardless of the state ofpassive
mode, whereas in NimBLE the callback does not get triggered whenpassive
mode is set.This seems like this behavior changed in NimBLE-Arduino after some of the initial commits - if this behavior change was intentional and expected to remain part of the library, it might be helpful to document the change somewhere.
Passive check in the NimBLE Library:
NimBLE-Arduino/src/NimBLEScan.cpp
Line 144 in 1544851
Line /w behavior in the Non-NimBLE Library: https://github.com/espressif/arduino-esp32/blob/1efcd21ba91c08e702a0c6e47e00a2d0a8c06b84/libraries/BLE/src/BLEScan.cpp#L127
The text was updated successfully, but these errors were encountered: