Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using QBluetooth to start multiple connections to BLE devices
Qt 6.11 is out! See what's new in the release blog

Using QBluetooth to start multiple connections to BLE devices

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lotuz 0
    wrote on last edited by lotuz 0
    #1

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

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

    Question

    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! :)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved