RTFM and Save Yourself Time

Bluetooth

I have a learning project to learn how to use Bluetooth with Flutter. This involves me setting up a Bluetooth server on a Raspberry Pi 3 B to make sensor readings from a Sense Hat available via Bluetooth.

Lately I’ve been focusing on Android and Flutter development, and using Firebase for my backends. Which means I haven’t done a lot of Unix & Linux development, mostly light Python, and bash scripts. I looked up the Linux Bluetooth libraries, and found Bluez. Then I looked for Python bindings for Bluez.

  • I was looking for a direct library binding
  • Most libs and articles I found focused on connecting a client to a server, and not implementing a server. Some libs even seemed to be client only.
  • The best example I found used dbus, which I didn’t understand.
  • I then looked for bindings in other languages, rust and golang.
  • Again, these seemed to focus on implementing clients, and not servers. Also, the Sense Hat only has a Python interface; other languages not oficially supported, and incomplete 3rd party support in other languages.
  • I eventually returned to the dbus example, and finally read the dbus documentation and examples.
  • dbus is how to talk to the Bluez server, which then talks to the hardware.
  • I should have looked at the dbus documentation much earlier and saved myself time.

Comments