Web Bluetooth - 自动连接到配对设备

Web Bluetooth - Auto Connect to paired device

有没有办法通过网络蓝牙自动连接到已配对的设备?

这样我就可以摆脱 google 中烦人的弹出式设备选择器了。

截至目前,我已经在 Chrome 中的标志后面实现了 navigator.bluetooth.getDevices()。要使用 API,需要启用 chrome://flags 中的实验性 Web 平台功能标志。请关注 Issue 577953: bluetooth: Get permitted devices 获取有关 getDevices() 的更新。

为了重新连接到设备,我还实现了 watchAdvertisements() API to allow apps to receive an Event when system perceives an advertisement packet from device on which this was called on. Please follow Issue 654897: bluetooth: Implement watchAdvertisements() 以更新此 API。

这两个是一个更大的项目的一部分,该项目旨在为 Web 蓝牙实现持久权限,以允许站点重新连接到他们已经有权通过设备选择器提示连接到的设备。