Building an app with bluetooth and libbluez-qt

Hi, I’m trying to build a simple GUI that connects to a bluetooth power meter in order to get the readings from it.

SailfishOS documentation talks about bluez and libbluez-qt. Though I couldn’t master how all this works and integrates easily in my app.
Is there some specific SFOS documentation on it or a sample "hello world’ example how to connect to a bluetooth device and send/receive some commands ?


I’m trying to install pybluez, but after I installed python3-devel and gcc, I’m having errors finding bluetooth.h (when installing with pip: pip install pybluez.
I understand SFOS have it’s own version of bluez (stuck at version 4?). Is there a way to make pybluez work?
Because I already have a python script that connects to my power meter in Linux, so maybe it’s easier to adapt it to SFOS?

You install bluez5 and best is to use kf5bluezqt-bluez5. You can have a look at the manuals and examples in KDE project.

you can look in my attempt to update buteo-plugins here in BTConnection.

IMO it is straight forward - I had more issues with openobex.

Thanks, I’ll have a look at the KDE examples. I have no account account on SFOS gitlab, I’ll create one and check the link soon.

I’ve been trying to use Qt’s bluetooth example, and the QML Bluetooth Scanner Example seemed simple.
But I couldn’t make the code run on SFOS.
My sample app compiles but I get a blank white page with an error in the console for importing the module module "QtBluetooth" is not installed .

set $TARGET to whatever your target is and check what you have installed

[mersdk@SailfishSDK SailfishOS-]$ sb2 -t $TARGET -m sdk-install -R zypper search bluetooth
Loading repository data...
Reading installed packages...

S | Name                                 | Summary                          | Type
  | jolla-settings-bluetooth             | Settings plugin for bluetooth    | package
i | qt5-qtconnectivity-qtbluetooth       | QtBluetooth                      | package
i | qt5-qtconnectivity-qtbluetooth-devel | QtBluetooth - development files  | package
  | sailfish-components-bluetooth-qt5    | Bluetooth UI components          | package
  | sailfish-homescreen-silica-bluetooth | The Sailfish Silica Bluetooth UI | package

I don’t know about that example

Thanks @deloptes.
I have exactly the same result on all 3 targets I have installed. Weird though. Maybe a missing QML libary :frowning:
I’ll have a look to the other examples and see what I can run.