Comments (4)
Chrome implements the Bluetooth.requestDevice()
method, including its options
parameter. The MDN refers to the filters
option as an array of BluetoothScanFilter
but the spec and Chrome use the name BluetoothLEScanFilterInit
, not that this difference is exposed to developers.
While the Permissions API integration is implemented in the sense that the algorithms there describe how permissions are managed the integration with the script-exposed query()
method is not. Developers must use Bluetooth.requestDevice()
or the upcoming Bluetooth.getDevices()
methods to request and query permissions. The getDevices()
method is under development and tracked by this ChromeStatus entry.
from web-bluetooth.
While the Permissions API integration is implemented in the sense that the algorithms there describe how permissions are managed the integration with the script-exposed query() method is not.
Thanks @reillyeon - much appreciated.
I understand that you are saying that you can't specify options to query and get back permitted devices. It sounds like instead users would check the permitted existing devices using getDevices()
?
Just FMI:
- Is the intent that you might be able to filter devices using
getDevices()
? - Is the plan ever to match the spec w.r.t. returning device, or is the intent to get the spec to match Chrome?
Further,
- are the spec event handlers all implemented, such as advertisementreceived (these aren't documented on MDN). Do we know the version they appeared in?
- What form does
optionalManufacturerData
actually take? It looks like an array of numbers, but what do those numbers map to? How are they used? It reads as though this is not used for filtering, but is data you want to make available to the origin after filtering. - The spec seems to indicate that
options
is optional, but not clear what gets fetched in this case. Thoughts?
from web-bluetooth.
I understand that you are saying that you can't specify options to query and get back permitted devices. It sounds like instead users would check the permitted existing devices using
getDevices()
?
Correct.
- Is the intent that you might be able to filter devices using
getDevices()
?
Filtering devices isn't supported by getDevices()
. It's unclear how useful this would be to developers.
- Is the plan ever to match the spec w.r.t. returning device, or is the intent to get the spec to match Chrome?
Supporting querying Web Bluetooth device permissions with navigator.permissions.query()
would be nice, but when I looked into supporting it for WebUSB there were some technical limitations in the Chromium implementation which meant it was difficult to implement and so I decided it wasn't worth the effort given that the functionality is duplicated by the getDevices()
method.
- are the spec event handlers all implemented, such as advertisementreceived (these aren't documented on MDN). Do we know the version they appeared in?
The advertisementreceived
event handler is used by two related features BluetoothDevice.watchAdvertisements()
and navigator.bluetooth.requestLeScan()
. Both of these are currently prototyped in Chromium but are not yet enabled by default.
- What form does
optionalManufacturerData
actually take? It looks like an array of numbers, but what do those numbers map to? How are they used? It reads as though this is not used for filtering, but is data you want to make available to the origin after filtering.
It operates similarly to optionalServices
. It doesn't filter the devices displayed to the user in the permission prompt but controls which manufacturer data fields provided in advertisementreceived
events. Bluetooth manufacturer IDs are integers. The "optional" versions of these parameters are useful because it allows the developer to declare the data they are interested in receiving from the devices without overly constraining the filter controlling which devices are presented to the user in the permission prompt.
- The spec seems to indicate that
options
is optional, but not clear what gets fetched in this case. Thoughts?
You're right that options
is not truly optional because one of filters
or acceptAllDevices
is required.
from web-bluetooth.
Thank you very much. I'm going to close this as answered "for now". When the currently experimental bits go live MDN will probably still need quite a bit of work.
FWIW from a developer point of view it is always best if specs match implementation. If matching the spec as it is is not feasible, then working to modify the spec while there are no other implementers would be a "good thing". I'm sure you know that.
from web-bluetooth.
Related Issues (20)
- requestDevice filters to exclude devices. HOT 1
- Would be nice to enable the Discussions on this repo, not everything is an issue HOT 1
- [watchAdvertisements] Support Extended Advertising HOT 8
- can't access services list on some devices HOT 2
- Kerem
- Services not found (Primary detected as Secondary?) HOT 3
- Using Bluetooth from WebExtension HOT 1
- Permissions API Extension HOT 3
- Not working with MacOS Sonoma + Intel HOT 1
- Add requestDevice User Prompt BiDi Extension Section to Bluetooth Spec
- p2p connection options HOT 3
- Filter on or prefer paired devices HOT 1
- Proposal does not reflect Chromium's dynamic device selection HOT 1
- Proposal: active scanning with scan response HOT 7
- navigator.bluetooth.requestDevice (opt) same filter but ios browser bluefy doesn't work HOT 2
- Unable to connect to the device, the error message is as follows HOT 1
- Broken references in Web Bluetooth
- Broken references in Web Bluetooth
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web-bluetooth.