有没有办法在浏览器中访问蓝牙连接的设备?
我正在尝试为大学项目构建一个利用跳跃运动的演示系统,并计划用HTML构建界面,因为跳跃运动支持JavaScript。
我希望系统能够完全控制手机上的蓝牙通话。正如大多数车载系统目前所做的那样;即接听电话,拒绝,打电话和查看联系人(如果可能)
答案 0 :(得分:2)
您可能需要查看Chrome蓝牙API,但您似乎需要安装Chrome的开发版本:https://developer.chrome.com/apps/bluetooth
答案 1 :(得分:0)
2017年1月试用后,Chrome现已推出。请阅读developer.google.com中的FrançoisBeaufort撰写的这篇文章:https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web
答案 2 :(得分:0)
您可以使用 Bluetooth Web API:
navigator.bluetooth.requestDevice({acceptAllDevices: true}).then(out => console.log(out))
令人讨厌的是,浏览器似乎需要蓝牙权限,调用上面的代码失败,否则蓝牙权限已被阻止。
要允许 macOS 使用蓝牙,请将应用添加到 System Preferences > Security & Privacy > Privacy > Bluetooth > Plus Button
: