【发布时间】:2017-05-06 13:39:36
【问题描述】:
好的,所以我在做一些研究:如何通过网页连接到蓝牙设备。我希望页面提示配对设备列表并连接到它们。(蓝牙打印机)。我找到了一些解决方案,但我不想在客户的 PC 上安装任何东西(如第三方应用程序)。我发现 google bluetooth api thingy 它适用于 BLE,问题是,我要连接的设备没有 BLE。我试过了
chrome.bluetooth.getDevices(function(devices) {
for (var i = 0; i < devices.length; i++) {
console.log(devices[i].address);
}
});
用于在 Chrome 开发者工具中进行测试,但返回错误
Uncaught TypeError: Cannot read property 'getDevices' of undefined
at <anonymous>:1:17
此 API 仅适用于 Chrome 应用程序,或者我在这里做错了什么:D。
【问题讨论】:
标签: google-chrome bluetooth webpage