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

Tomasz Siekierda sierdzio at gmail.com
Fri Jun 29 08:27:42 CEST 2018


On Thu, 28 Jun 2018 at 22:40, Jason H <jhihn at gmx.com> wrote:

> I've used bluetoothctl to pair to my mac, but when I try to get local
> adapters on the Pi from Qt, there are none:
>
> log:
> Local Adapters:
> ASSERT: "!isEmpty()" in file
> /usr/include/arm-linux-gnueabihf/qt5/QtCore/qlist.h, line 294
>
>
> code:
>         auto localAdapters = QBluetoothLocalDevice::allDevices();
>         qDebug() << "Local Adapters:";
>         for (const auto &adapter: localAdapters) {
>                 qDebug() << adapter.address().toString() << adapter.name();
> // <<pairingStatus(adapter.address());
>         }
>
>         bool result = listen(localAdapters.first().address());
>
> Any ideas on what it takes to get it working on a Pi? When I run it on my
> mac, it is fine.
>

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.

Second: check if BT is stable in the system using some BT device (like
bluetooth headphones or something). If you can pair a device in the system
itself (and if the connection is stable / not dropped after reset etc.)
then Qt will see it, too.

Ah and lastly, be sure to install all QBluetooth dependencies. If you
cross-copile Qt yourself, make sure bluetooth support is listed as enabled
(by default it is not). Some packages worth installing:

sudo apt install libinput-dev libts-dev bluez libbluetooth-dev



>
> I'm also relatively new to BT. I've copied the chat example as close as
> possible. But I have _so_many_ questions.
>
> Ultimately, I am providing a serial interface service over BT that
> operates some hardware on the Pi. the mac/android app will connect to it.
> I'm currently doing this with sockets but I don't want to require IPs or IP
> infrastructure.
>
> _______________________________________________
> 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/0c9ca983/attachment.html>


More information about the Interest mailing list