Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Using QBluetooth to start multiple connections to BLE devices
lotuz 0 last edited by lotuz 0
I want to use Qt's Bluetooth Low Energy to connect to two BLE devices.
- OS: Arch Linux 4.13.8
- bluez version: 5.47
- BLE adaptor: Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Code / Error
I use have two QLowEnergyControllers instances like this:
controller0 = QLowEnergyController::createCentral(qBluetoothDeviceInfoBLE0, this)); controller1 = QLowEnergyController::createCentral(qBluetoothDeviceInfoBLE1, this));
If then successfully conneect with
BLE0, and after the signal
connected()is emited, I initiate a connection to
BLE1. The connection to
BLE0will be aborted:
qt.bluetooth.bluez: Cannot connect due to pending active LE connections qt.bluetooth.bluez: void QBluetoothSocketPrivate::_q_readNotify() 17 error: -1 "Software caused connection abort"
The connection to
BLE1will be established successfully.
What I found in the docs of QLowEnergyController:
It is important to mention that some platforms such as a BlueZ based
Linux cannot maintain two connected instances of QLowEnergyController
to the same remote device
BLE1are different remote devices.
I can also confirm that connecting to the same devices works with my version of bluez. Not only via command shell, but it also works when using nodejs' package and noble.
- Should it work as I have done it above? (connect to
BLE0, and afterwards
- I was thinking of using a second adaptor, is it correct that QBluetooth can only use one adaptor (the default one)?
- Can somebody think of any workaround?
Thanks a lot for any help! :)
Sounds like it could be a low level issue. I'd recommend bringing this to the interest mailing list. You'll find there QtConnectivity module's developers/maintainers. This forum is more user oriented.