'Dbus Bluez Indicate Notification

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?



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ukBaz