-
-
Notifications
You must be signed in to change notification settings - Fork 179
Handling duplicate scan result when filter mode is address and data #968
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
Comments
This doesn't sound right, probably a bug, but this situation is different that I have seen before. The data should be reported when complete and it should follow the filtering. |
OK.
and the corresponding
I'm quite sure |
On first scan event, the output is:
where 4 == BLE_HCI_ADV_RPT_EVTYPE_SCAN_RSP On the second scan event (where the address is duplicate, but manufacturer data has changed), the event type changes to:
where 0 == BLE_HCI_ADV_RPT_EVTYPE_ADV_IND |
That makes sense, when the new advertisement comes it will not call onResult because it is not a scan response so you will need to catch it in the onDiscovered callback. |
Ah! So, this now becomes a question of "how do I get a callback with active scan response data when manufacturer data changes?" (Yes, I could handle this in the calling application by caching results) |
Good question, I think the logic needs to change such that when an advertisement is detected and the device is already known, the callback count value should be reset. |
I started drilling down, but my knowledge thins out very quickly, so this may be all wrong. nRF Connect confirms that even when the manufacturer data changes, active response data is returned. So, I'm starting to think the problem is actually upstream or configuration. I got stuck at |
This is a filter that is applied inside the controller and we cannot see that code. What I suspect is that the scan response doesn't come because it's data hasn't changed, I could be wrong and maybe it's a bug as well. |
Is there any doco on the function signature? The bit mask passed in looks like magic.
Ah, yes, I could believe that as weird as it is. |
I just tested this by changing the device name during scan. |
I've recently come across a device that actively advertises, then changes manufacturer data when set to pair.
After some poking about, I set the scan filter mode with:
with the expectation that
onResult()
would be called due to a non-duplicate advertised device appearing.This didn't happen, so debug logs got enabled.
It turns out the underlying esp framework does respect this scan mode, I can see the device being reported as 'new'.
However, after reviewing
NimBLEScan
, I think NimBLE-Arduino is only using the device address for its uniqueness check here and the log output:and thus
onResult()
does not get called when the data changes.Is there a recommended way to handle this scenario?
For now I'm just starting the scan after the manufacturer data changes.
The text was updated successfully, but these errors were encountered: