[Interest] Bluetooth on Qt on Pi (for real this time)

Jérôme Godbout godboutj at amotus.ca
Fri Jun 29 16:06:36 CEST 2018


I'm not sure you want to do Bluetooth EDR or Bluetooth Low energy (they are not the same thing at all, they use the same antenna but have a different network stack)


For BLE:

Make sure you understand all the connection concept (pairing != connecting). Pairing is recurent connection that can be reestablish with some key exchange.

You have different level of connection and security (you probably want to avoid security at first to help you debug, and it's fairly simple to add it on top of the connection, it's just a more exchange mostly).

There's advertising concept where you tell other device you are willing to connect (peripheral role) and the device that will establish the connection (central role).
Once you connect, you need to check device capacity on each device to see what can be done to secure the connection.

Most of those step are often taken care inside a bluetooth stack but understanding them in high flight is a most to understand what is going on and what you will need.

On a side note: Pi BLE is horrible, Android BLE is a huge pain and unstable as hell (restart the device and Bluetooth stack often to make sure you ain't fight Google Android fight here). BLE on iOS is full of shadowed information (address of device some advertissing data into CoreLocation are strip away). The BLE landscape is a huge mess mostly because the big player played clown with it. Brace yourself with a lot of patience, it ain't as fun as the traditional networking. This is sad, cause the spec is clair and sound, a bit complicated to understand.

My 2 cents.

________________________________
From: Interest <interest-bounces+godboutj=amotus.ca at qt-project.org> on behalf of Jason H <jhihn at gmx.com>
Sent: June 29, 2018 9:33 AM
To: Maurice Kalinowski
Cc: Interest at qt-project.org
Subject: Re: [Interest] Bluetooth on Qt on Pi (for real this time)

Thanks all for your experience reports. Looking around, it seems that  disabling the built-in BT and going wth a dongle worked for some people. Has anyone tried that?

As for me bing a Bluetooth noob, what do I need to know about Bt vs TCP sockets? Speficically:
Can I access my service without pairing?
During pairing does my service have to be active?
Once paired, can I restart my service without having to re-pair?
Since my protocol is serial (Rfcomm) Do I have to use the existing serial Uuid?
How can I set the Pi to automatically pair with my application?

Many thanks!

Sent: Friday, June 29, 2018 at 3:44 AM
From: "Maurice Kalinowski" <Maurice.Kalinowski at qt.io>
To: "Tomasz Siekierda" <sierdzio at gmail.com>, "Shawn Rutledge" <Shawn.Rutledge at qt.io>
Cc: "Interest at qt-project.org" <interest at qt-project.org>
Subject: Re: [Interest] Bluetooth on Qt on Pi (for real this time)

>
> BT on Raspberry Pi is very unstable. I've tried to work with it 6 months ago and actually abandoned the project because it was practically unusable. However, I've noticed they have released a lot of software and firmware updates since then. So my first suggestion: upgrade Raspbian (if you are using it) to newest version.

Have they updated their Qt version yet?  Last time I tried Bluetooth on the Pi, a few months ago, they still had 5.7, which is ridiculous IMO.  I wanted to try BLE, so had to recompile Qt on the Pi.  And yeah, BT wasn’t stable either.



I don't think so, Raspbian usually sticks to the same Qt version for whole release cycle. So, last Raspbian had Qt 5.2, this one has 5.7 and that's it. I haven't checked recently, though, I always compile my own anyway.



[Maurice Kalinowski]

On the SensorTag demo we did for Qt for Automation we also recognized a heavy instability of BT on the Pi. Basically on every third boot “rfkill unblock” and “hciconfig” are your weapons. It’s hard to automate this, but that might be somewhat of an option for prototyping. Basically you need to restart the whole BT stack after a boot a second time.



Maurice



P.S.:Please forgive my Outlook reply-for format.

_______________________________________________ Interest mailing list Interest at qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180629/aa85bc1b/attachment.html>


More information about the Interest mailing list