dbus bluez表示通知

发布于 2025-01-22 00:05:12 字数 108 浏览 3 评论 0原文

在dbus中,org.bluez.gattcharacteristic1的接口具有一个接口startNotify()。这可以通过定义的回调正常工作。如何用表示启用通知?

In Dbus the interface for org.bluez.GattCharacteristic1 has an interface StartNotify(). This works fine with a callback defined. How do I enable notify with indicate?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

魔法唧唧 2025-01-29 00:05:12

是否是Notify指示 startNotify()函数用法是由其操作的特征定义的。

例如,使用bluetoothctl来查看BBC Micro上的两个特征:位您可以看到一个人支持notify inde。您将在这两个上都使用startNotify()

[bluetooth]# connect E1:4B:6C:22:56:F0 
Attempting to connect to E1:4B:6C:22:56:F0
[CHG] Device E1:4B:6C:22:56:F0 Connected: yes
Connection successful
[CHG] Device E1:4B:6C:22:56:F0 ServicesResolved: yes
[BBC micro:bit [toveg]]# gatt.attribute-info e95d9250-251d-470a-a062-fa1922dfa9a8
Characteristic - Vendor specific
        UUID: e95d9250-251d-470a-a062-fa1922dfa9a8
        Service: /org/bluez/hci0/dev_E1_4B_6C_22_56_F0/service003c
        Notifying: no
        Flags: read
        Flags: notify
[BBC micro:bit [toveg]]# gatt.attribute-info 6e400002-b5a3-f393-e0a9-e50e24dcca9e
Characteristic - Nordic UART TX
        UUID: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
        Service: /org/bluez/hci0/dev_E1_4B_6C_22_56_F0/service0028
        Notifying: no
        Flags: indicate

Whether it is notify or indicate that the StartNotify() function uses is defined by the characteristic it is operating on.

As an example, using bluetoothctl to look at two characteristics on a BBC micro:bit you can see that one supports notify and one supports indicate. You would use StartNotify() on both.

[bluetooth]# connect E1:4B:6C:22:56:F0 
Attempting to connect to E1:4B:6C:22:56:F0
[CHG] Device E1:4B:6C:22:56:F0 Connected: yes
Connection successful
[CHG] Device E1:4B:6C:22:56:F0 ServicesResolved: yes
[BBC micro:bit [toveg]]# gatt.attribute-info e95d9250-251d-470a-a062-fa1922dfa9a8
Characteristic - Vendor specific
        UUID: e95d9250-251d-470a-a062-fa1922dfa9a8
        Service: /org/bluez/hci0/dev_E1_4B_6C_22_56_F0/service003c
        Notifying: no
        Flags: read
        Flags: notify
[BBC micro:bit [toveg]]# gatt.attribute-info 6e400002-b5a3-f393-e0a9-e50e24dcca9e
Characteristic - Nordic UART TX
        UUID: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
        Service: /org/bluez/hci0/dev_E1_4B_6C_22_56_F0/service0028
        Notifying: no
        Flags: indicate
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文