[ubuntu-za] Bluetooth Interface

Charl Wentzel charl.wentzel at vodamail.co.za
Mon Jan 28 14:24:01 UTC 2019


Hi Guys

This is a very technical Bluetooth query.  I'm hoping someone has worked 
with this before and can help me out.

I spent the last two month creating a Bluetooth application for a 
customer.  Using a small embedded PC running Ubuntu sever, I need to 
scan for BLE devices with specific advertising parameters and then 
connect and download data from it using a notification service.  Most of 
this time I spent figuring out how to interface with a bluetooth device 
using Linux Bluez interface.

What a journey:
1. The documentation is almost non-existent.  I had to use a combination 
of reading the Bluetooth specification, reading the Bluez source and 
using Wireshark to figure out how it all works.
2. Bluez is solidly tied into glib and dbus, which is complete 
unnecessary for my application.  The API is written such that Bluetooth 
is the centre of the universe, making it hard to integrate it with 
anything else such as network sockets unless your writing a 
glib/gnome-based application. So I had to write a lot of my own code to 
eliminate these libraries.

So now I finally eliminated all of that and I have an application that 
is in complete control of what it needs to do. The problem now is that 
the bluetooth daemon interferes.  As soon as I connect to my device, the 
bluetooth daemon rushes in performs a GATT service discovery and setups 
up and responds to notifications and indications from my device.  This 
of course is to expose the device on dbus, which is not what I want.  So 
essentially there are "two masters" trying to communicate with the 
device; my application and the bluetooth daemon.

If I deactivate the daemon, I loose HCI interface, so now I'm stuck 
between a rock and a hard place.  How can I communicate with the 
bluetooth device without having the bluetooth daemon trying to 
communicate with the device?

Anybody with some advice?

Regards
Charl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-za/attachments/20190128/cd664933/attachment.html>


More information about the ubuntu-za mailing list