Bluetooth 使用PWA的蓝牙连接
根据PWA,它支持“BR/EDR或LE连接” 我试图在Chrome devtools的控制台上使用以下代码进行测试:Bluetooth 使用PWA的蓝牙连接,bluetooth,google-chrome-devtools,progressive-web-apps,Bluetooth,Google Chrome Devtools,Progressive Web Apps,根据PWA,它支持“BR/EDR或LE连接” 我试图在Chrome devtools的控制台上使用以下代码进行测试: navigator.bluetooth.requestDevice({ acceptAllDevices: true, }) .then(device => { // Human-readable name of the device. console.log(device.name); console.log(device.id); // Attemp
navigator.bluetooth.requestDevice({
acceptAllDevices: true,
})
.then(device => {
// Human-readable name of the device.
console.log(device.name);
console.log(device.id);
// Attempts to connect to remote GATT Server.
return device.gatt.connect();
})
.then(server => { /* ... */ })
.catch(error => { console.error(error); });
我正在使用蓝牙音乐盒来测试它。它被确认为“XTREME”,如下所示:
当我选择“XTREME”设备并单击“PAIR”时,我在控制台上得到一个“Unsupported device”错误,如下所示:
我尝试了许多其他蓝牙设备,得到了相同的“不支持的设备”信息。
发生了什么事?它不应该得到支持吗?我如何知道支持哪种设备?理想情况下,我该怎么做才能知道我的特定目标设备是否受支持
请帮忙
Tks 问题似乎在于Web Bluetooth只实现很少的Bluetooth协议(GATT和LE) 有关蓝牙协议的更多信息,请参见: 您可以使用和应用程序来检查设备协议,看看它是否实现了GATT或LE,以检查Web蓝牙兼容性。例如: