Unsolved Using QBluetooth to start multiple connections to BLE devices
-
Problem
I want to use Qt's Bluetooth Low Energy to connect to two BLE devices.
System
- 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 signalconnected()
is emited, I initiate a connection toBLE1
. The connection toBLE0
will 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
BLE1
will be established successfully.Found
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 deviceNote:
BLE0
andBLE1
are 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.
Question
- Should it work as I have done it above? (connect to
BLE0
, and afterwardsBLE1
)? - 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! :)
-
Hi,
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.