问题标签 [web-bluetooth]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
255 浏览

google-chrome-extension - Google Chrome 扩展程序可以访问 Web 蓝牙 API 吗?

我搜索了网络蓝牙文档和chrome.bluetooth 文档,但似乎他们只提到 Chrome 应用程序能够访问 API,它没有说明任何关于扩展的信息。

0 投票
3 回答
3153 浏览

google-chrome-extension - Web Bluetooth API get list of all available device nearby

I am looking for an API call that could be used to retrieve all the Bluetooth devices near me. These samples Web Bluetooth talk about getting different characteristics from a single Bluetooth device, however I couldn't find any example which retrieves all the Bluetooth devices(like available bluetooth devices list on windows native Bluetooth app). Is it even supported?

0 投票
3 回答
2824 浏览

angular - “导航器”类型上不存在属性蓝牙

我将示例代码集成到我的 Angular 6 项目中。但是有一些编译错误。这些错误之一是:“导航器”类型上不存在属性“蓝牙”。

为什么会发生此错误,我该如何解决?

0 投票
1 回答
2600 浏览

angular - navigator.bluetooth 在打字稿中不起作用

我正在尝试进行 chrome 蓝牙 API 调用,但我没有通过打字稿获得成功。我已经尝试在 html() 中应用文件但也无济于事。但是,如果您复制代码并将其粘贴到浏览器控制台中,代码将完美运行:(

控制台错误(如果在 Ts 中运行代码):

// 打字稿/TS:

// 在控制台浏览器中工作:

// 项目信息:

角 CLI:6.0.8

节点:8.11.3

操作系统:linux x64

角度:6.0.9

0 投票
0 回答
113 浏览

google-chrome - 对 Web 蓝牙的 chrome 支持在不同的 Android 6/7 设备上仍然不是很普遍吗?

我正在通过在 Android 上的 Chrome 上运行的 Web 应用程序支持蓝牙低功耗设备。我从三星手机通信没有问题,但我刚刚使用的平板电脑显示“无法连接到蓝牙设备!” 在页面https://webbluetoothcg.github.io/demos/bluetooth-printer/上进行测试时。

当我查看 chrome://bluetooth-internals 时,即使打开了蓝牙,Discoverable 和 Discovering 也被禁用。我找不到任何关于为什么 Discoverable 和 Discovering 会被禁用的信息。

该平板电脑是带有 Android 7.1.1 的 Lenovo 4 Tab 10(型号 TB-x304L),该设备应该支持蓝牙 4.1 和 BLE。

尽管 BLE 已经出现了一段时间,但对 Web 蓝牙的 chrome 支持在不同设备上是否仍然不是很普遍?

0 投票
1 回答
1490 浏览

javascript - 在 Chrome 网络蓝牙 API 中未经用户许可连接到配对设备?

通过使用 API navigator.bluetooth.requestDevice(),网页可以请求用户允许他与蓝牙设备配对并建立连接。批准请求后,假设用户重新加载网页。有没有办法让网络连接到该配对设备而无需再次请求许可?

我知道我们可以使用 API navigator.usb.getDevices() 在 web-usb 中做到这一点,但我找不到在 web-bluetooth 中做到这一点的方法。任何人请帮忙。

谢谢

0 投票
0 回答
249 浏览

javascript - 无法使用 Google Web-blutetooth API 连接到设备的 GATT 服务器

我正在尝试使用 Google 的网络蓝牙 API 打印我的 RealME-1 手机的所有特征。代码如下:

但是,在测试时,它会卡在 device.gatt.connect() 上。有什么我想念的地方吗?

谢谢

0 投票
0 回答
287 浏览

javascript - 无法写入特征 WebBLE

我有这个 index.html 文件,它与通过 BLE 运行 bleno 应用程序的 Raspberry pi 3 对话。

我可以从 ble 外围设备读取特征,但由于 index.html 第 0 行的未知原因,我得到了 DOMException GATToperation failed。

我在 Pi 上的 bleno 应用,app.js

你们能帮我解决我哪里出错了吗?

谢谢

0 投票
0 回答
44 浏览

bluetooth - 从写入读取响应的解决方法

https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-writevalue,我看到 writeValue 返回一个 DataView,但我的 Chrome 上一直为空(版本 70.0.3538.77(官方版本)(64-位)在高山脉)。

我所做的如下,writeValue() 的状态为空,readValue() 的值是一个空的 DataView:

0 投票
1 回答
713 浏览

javascript - WebBluetooth 在 Windows 但不是 OSX 上的写入特性失败

我正在尝试通过网络蓝牙将示例十六进制字符串发送到 BLE 设备。

此字符串在 OSX 上发送得非常好,但是当我尝试在 Windows 上发送它时,我收到以下错误:

这是我用来发送字符串并进行转换的代码:

这是我的 str2ab 函数: