-
Notifications
You must be signed in to change notification settings - Fork 195
Specify a Bluetooth Scanning API. #239
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
Conversation
scanning.bs
Outdated
</p> | ||
<ol> | ||
<li> | ||
If |event| doesn't <a for="BluetoothLEScanFilter">match</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this leaves no way to do a completely open scan. It has to be filtered for some UUID or Manufacturer ID. Is that OK, or do we need an extra filter type to match everything? (I don't want to make no-filters the sign for completely-open because that makes the API non-monotonic: reducing the number of filters would match less, less, less, and then more advertisements.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to #234 I think developers will have good use cases for matching everything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is BluetoothLEScanOptions.acceptAllAdvertisements
now.
I wonder why developers would use |
@beaufortfrancois At the moment, |
This makes more sense now ;) So once you have a navigator.bluetooth.requestLEScan({
filters: [{manufacturerData: 0x004C}]
}).then(() => {
navigator.bluetooth.addEventListener('advertisementreceived', event => {
if (!event.device.gatt) {
// How do I connect to this device specifically?
}
})
}) |
There's no API for that yet, and I've mailed the security UI folks to ask their opinion on it. The benefits of the chooser are that 1) the user has to pay enough attention to make a choice, and 2) the user can override the page's idea of which device is best. If we ensure that exactly one device appears in the chooser that opens as a result of an advertisement, then we lose both of those. On the other hand, we might be able to add a |
This doesn't cover scanning from a service worker yet.
Fixes #191.
Previews at https://rawgit.com/jyasskin/web-bluetooth-1/scanning/scanning.html and https://rawgit.com/jyasskin/web-bluetooth-1/scanning/index.html#bluetoothdevice