【发布时间】:2019-01-27 20:04:34
【问题描述】:
使用navigator.bluetooth.requestDevice(),我可以访问我已经使用本机 OSX 蓝牙配对设置配对的蓝牙设备,但没有出现以前未配对的设备,即使它们的属性与我的通用查询匹配。可用设备以 Chrome 模式显示,请求用户同意配对,但唯一显示的设备是我已经配对的设备。
我是否误解了此处的预期用例,或者是否有其他方法可以通过 Chrome 与附近的(以前未配对的)设备建立连接?
文档:https://webbluetoothcg.github.io/web-bluetooth/ (见示例 2)
function bluetoothConnect() {
navigator.bluetooth.requestDevice({filters: [{services: ['generic_access']}]})
.then(device => {console.log(`Connected to: ${device.name}`)})
.catch(console.error);
}
【问题讨论】:
-
嗨.. 希望您找到了答案,看来您在这个问题上工作了很长时间。如果您还记得,您实际上是如何通过 api 取消配对 BLE 设备的?
标签: javascript google-chrome web-bluetooth