user1505132
user1505132

Reputation: 71

Bluetooth: Detect Event Using Bluez

Upvotes: 7

Views: 5517

Answers (2)

Michael Shaw
Michael Shaw

Reputation: 304

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.

  • Determine the bluetooth interfaces implemented by your headset. I used d-feet and explored the device when it was connected. You can manually control and read status from the headset here, this came in handy for debugging.
  • Generate,find or create the dbus xml descriptions of the required interfaces. I did this manually by translating the api specification from the bluez api documentation to xml however I believe you could also create them by dbus introspection.
  • Use dbusxx-xml2cpp to generate proxy objects
  • Determine the callback that is called when your button is pressed
  • Integrate proxy objects into your code as required

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!

Upvotes: 1

ashish
ashish

Reputation: 1381

hcidump as collected are the logs between device host and controller. Events are the ones which controller had send to device host and commands are the request/responses sends to device host.

Bluez programming guide : http://people.csail.mit.edu/albert/bluez-intro/

Upvotes: 0

Related Questions