Important: Please read the Qt Code of Conduct -

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.


    • 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 BLE0 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.


    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

    Note: BLE0 and BLE1 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.


    1. Should it work as I have done it above? (connect to BLE0, and afterwards BLE1)?
    2. I was thinking of using a second adaptor, is it correct that QBluetooth can only use one adaptor (the default one)?
    3. Can somebody think of any workaround?

    Thanks a lot for any help! :)

  • Lifetime Qt Champion


    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.

Log in to reply