Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85818

QLowEnergyController in peripheral role on Android does not manage connection as expected.



    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.0
    • Fix Version/s: None
    • Labels:
    • Platform/s:


      With a QLowEnergyController created in peripheral role you get some very unexpected behavior regarding connections.


      The first issue is that once a remote device connects to the Qt Android peripheral - if that remote device disconnects from the Qt Android device, the QLowEnergyController will close down the BluetoothGattServer. This means that a new BluetoothGattServer must be created to allow future connections - the whole peripheral must be set up all over again. When you create a new BluetoothGattServer, you get a new Bluetooth address so the device that was originally connected must rescan to find the new address. Additionally, if you were to have two or more remote connections the Qt Android peripheral, all connections would be dropped as soon as the first remote device disconnects.


      The second issue is that the BluetoothGattServerCallback.onConnectionStateChange method appears to be called for every BluetoothDevice even if you connected to it via a QLowEnergyController in the central role. This means that if your application acts both as a central and as a peripheral and if you lose your connection to the remote device connect to via the central, you also lose your peripheral BluetoothGattServer and must recreate it which results in getting a new Bluetooth address.


      The QLowEnergyController should behave more like a server object. It should be able to handle multiple concurrent Bluetooth connections and those connections should be able to come and go without disrupting the peripheral. The peripheral should only close down when explicitly instructed to do so, not whenever a remote device disconnects.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            ablasche Alex Blasche
            crobertdiii Robert Daniels
            1 Vote for this issue
            3 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes