-
Notifications
You must be signed in to change notification settings - Fork 189
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
Proposal: active scanning with scan response #623
Comments
This sounds like platform-specific differences showing through. On Windows, different events are received for each advertisement packet received so we get separate events for "regular" advertisement data and a separate event for the scan response. But on macOS, Android and Linux events only indicate that something in the advertisement data changed and there is no way to tell on those platforms which information was in the advertisement data and which data was in the scan response. So this one is probably more of an implementation issue where Windows needs to be made to work more like the other platforms under the hood so that web developers don't have to handle OS-specific differences in their apps. Also, on macOS, passive scanning is not possible (also not an easy way to do it on Linux). So I think it only makes sense to have active scanning in WebBLE. |
Just to clarify, does the "scan response" mean |
"scan response" in this context means an advertisement data packet with a PDU Type of I would expect |
Yes, I would assume In Chromium: |
It seems that the teams implementing BLE scanning and advertising would need to unify how scan responses work across all platforms. However, with no clear instructions on how it should work, it could lead to different implementations on different browsers, resulting in an API that cannot be used in the real world, or at least is very difficult to use. For example, on Android, scan response is integrated with advertising data (see: context), but from my experience on iOS, the data is split into two subsequent messages. I have found that it works similarly on Windows. My proposal is to add a field in the scan event for the scanResponseData (similar to serviceData). This way, it would be clear to teams implementing the specification that they should include this data (or null if not present) inside the event, and therefore they must glue together incoming SCN_RSP data packets with ADV packets |
From the conversation above it sounds like the issue is whether two |
@reillyeon, based on my experience with Chromium implementation, I've observed missing data when using Considering this, it's conceivable that different browsers may handle data combination differently, leading to potential debugging challenges. To streamline this process, a simple addition to the Web Bluetooth spec could be added. If the specification explicitly stated whether scan responses should be combined or split, browser developers could align their implementations accordingly facilitating long-term maintenance. |
Currently, there is no option in
requestLEScan
to listen for scan responses, nor is there a field inBluetoothAdvertisingEvent
to access the scan response. I believe it would be beneficial to introduce 'normal' and 'active' scan modes, as there appears to be confusion in various implementations at present.For instance, in Chromium, the
watchAdvertisements
method returns two subsequent events: one with standard manufacturer data and another with the scan response. However, when usingrequestLEScan
, only the standard advertising response is provided.I propose that establishing a clear distinction would, at the very least, aid in determining which API is stable enough in different implementations to effectively utilize scan responses.
The text was updated successfully, but these errors were encountered: