The output of hcidump when the device is connected and the button is pressed is:
HCI sniffer - Bluetooth packet analyzer ver 2.2
device: hci0 snap_len: 1028 filter: 0xffffffff
HCI Event: Mode Change (0x14) plen 6
status 0x00 handle 21 mode 0x00 interval 0
Mode: Active
ACL data: handle 21 flags 0x02 dlen 17
L2CAP(d): cid 0x0041 len 13 [psm 0]
< ACL data: handle 21 flags 0x00 dlen 14
L2CAP(d): cid 0x0047 len 10 [psm 0]
< ACL data: handle 21 flags 0x00 dlen 22
L2CAP(d): cid 0x0047 len 18 [psm 0]
< ACL data: handle 21 flags 0x00 dlen 22
L2CAP(d): cid 0x0047 len 18 [psm 0]
HCI Event: Number of Completed Packets (0x13) plen 5
handle 21 packets 1
ACL data: handle 21 flags 0x02 dlen 18
L2CAP(d): cid 0x0041 len 14 [psm 0]
< ACL data: handle 21 flags 0x00 dlen 14
L2CAP(d): cid 0x0047 len 10 [psm 0]
HCI Event: Number of Completed Packets (0x13) plen 5
handle 21 packets 1
HCI Event: Number of Completed Packets (0x13) plen 5
handle 21 packets 1
HCI Event: Number of Completed Packets (0x13) plen 5
handle 21 packets 1
HCI Event: Mode Change (0x14) plen 6
status 0x00 handle 21 mode 0x02 interval 2048
Mode: Sniff
I did something similar last year. The approach I settled on was using libdbus-c++ to generate c++ proxy objects/classes to communicate with bluez via dbus.
You will need to link your code to libdbus-c++ and have it install on the target too.
You can use the generated proxy objects to access the entire functionality of the headset, it may come in handy for a lot more than catching a button press!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With