我开发了 BLE 应用程序openwrt
using BLUEZV5.30
。我能够通过提取源代码来创建应用程序gatttool
and hcitool
。我还添加了这些工具提供的更多功能(例如阅读rssi
).
不过,我已经升级了我的bluez
堆叠到5.42
我打算使用DBUS
所有 BLE 相关操作的接口。我想要的功能:
- 读取RSSI
- 连接和断开
- Bonding
- Pairing
- 删除绑定信息
- 发现
- Scanning
- 广告
- 写入/读取特性
- 通知和指示
我能够使用用 C++ 编写的代码执行上述所有操作(除了绑定和配对)。但是,由于我现有代码存在一些问题并且无法配对/绑定,我想迁移到 dbus 接口。但是,我不确定其中的错误BLUEZ DBUS API
以及 API 提供的功能。我读过这个API Doc https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc但它没有给出DBUS接口的任何清晰图片。
我的问题是我不确定我是否可以获得所有必需的功能dbus api
?我已阅读文档(bluez dbus api),但我仍然不确定。
正如你在另一篇中提到的post https://stackoverflow.com/questions/30808453/bluez-5-30-d-bus-gatt-api-simply-discover-and-connect-to-a-ble-device-in-c/36919742?noredirect=1#comment74210660_36919742我更新了gattlib https://github.com/labapart/gattlib/支持 Bluez DBUS API。
gattlib
是用 C 编写的。如果您不想使用它,查看其代码应该会帮助您取得进展。
从 Bluez v5.42 开始,GATT D-BUS API 不再标记为实验性 http://www.bluez.org/release-of-bluez-5-42/.
DBUS API 描述如下:https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc。还有(蟒蛇)examples https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test演示 API。
- 读取RSSI https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/device-api.txt
- 连接和断开 https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/device-api.txt
- Pairing https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/device-api.txt
- 发现 https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/adapter-api.txt
- Scanning https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/adapter-api.txt
- 广告 https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt
- 写入/读取特性 https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt
- 通知和指示 https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt
- 绑定和删除绑定信息:看起来是透明的使用DBUS API https://www.spinics.net/lists/linux-bluetooth/msg47687.html.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)