我已经使用 BLUEZV5.30
为 openwrt
开发了 BLE 应用程序。我能够通过提取源代码 gatttool
和 hcitool
创建应用程序。我还添加了一些由这些工具提供的功能(例如阅读 rssi
)。
但是,我已经将我的 bluez
堆栈升级到 5.42
,并且我计划使用 DBUS
接口(interface)进行所有 BLE 相关操作。我想要的功能:
- 读取 RSSI
- 连接和断开连接
- 结合
- 配对
- 删除绑定(bind)信息
- 发现
- 扫描
- 广告
- 写/读特征
- 通知和指示
我能够使用用 C++ 编写的代码执行上述所有操作(绑定(bind)和配对除外)。但是,由于我现有代码的一些问题以及无法配对/绑定(bind),我想迁移到 dbus 接口(interface)。但是,我不确定 BLUEZ DBUS API
中的错误以及 API 提供的功能。我读过这个API Doc但它没有给出任何清晰的 DBUS 接口(interface)图片。
我的问题是我不确定是否可以使用 dbus api
获得所有必需的功能?我已经阅读了文档 (bluez dbus api),但我仍然不确定。
最佳答案
正如您在另一个 post 中提到的我更新了gattlib支持 Bluez DBUS API。
gattlib
是用 C 语言编写的。如果您不想使用它,查看它的代码应该有助于您的进步。
自 Bluez v5.42 起,GATT D-BUS API is not longer mark as experimental .
此处描述了 DBUS API:https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc .还有(python)examples演示 API。
- Reading RSSI
- Connecting and Disconnecting
- Pairing
- Discovery
- Scanning
- Advertising
- Write/Reading to Characteristics
- Notifications and Indications
- 绑定(bind)和删除绑定(bind)信息:using DBUS API时看起来是透明的.
关于c++ - 用于 BLE 的 BluezV5.42 DBUS C API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43475751/