Important: Please read the Qt Code of Conduct -

Qt BLE Discovery Can't Find Some Devices On Windows

  • Qt 5.12.5
    MSVC2017 32-bit, 64-bit
    MSVC2015 32-bit, 64-bit
    Windows 10 x64 OS

    I have been working on a Windows widgets project with BLE connectivity option. I noticed that Qt Bluetooth examples can't find the particular BLE device that I want to work with.

    I tried these examples:

    Bluetooth Low Energy Discovery Example
    QML Bluetooth Discovery Example
    Bluetooth Low Energy Heart Rate Game

    These are finding some other BLE devices around but not my device.

    I tried to increase the discovery timeout from 5sec to 15sec but it didn't help.

    Microsoft Bluetooth LE Explorer application can discover my device successfully on the same PC.

    I tried the Qt and compiler versions listed above on two computers, they both couldn't find my device.

    Strangely, I have used Qt for my BLE device last year after some struggle but eventually I had managed to get it to work flawlessly. I don't remember my Qt version at the time.

    Currently I am downloading Qt 5.12.2 kit, hoping to fix the issue.

    Any ideas?


  • Switching to Qt 5.15.2 made a difference.
    Now BLE discovery examples and my previous project can find my custom device.

    Unfortunately now I can't connect to the device since QLowEnergyState does not become QLowEnergyService::ServiceDiscovered.

    stateChanged signal is emitted but
    QLowEnergyService::ServiceState is ending up QLowEnergyService::DiscoveryRequired state. I don't know why but the same code was working on an unknown Qt version as-is.

    I am calling discoverDetails when service scan is done.
    I can see that my serviceUuid is found and listed by the way.

    void myBLE::serviceScanDone()
            qDebug()<<"Service Scan Finished";
            static const QString serviceUuid( myUuid );
            m_service = m_control->createServiceObject(QBluetoothUuid(serviceUuid), this);
            connect( m_service , SIGNAL( characteristicChanged(QLowEnergyCharacteristic,QByteArray)),
                     this      , SLOT  ( updateData(QLowEnergyCharacteristic,QByteArray           )) );
            connect( m_service , SIGNAL( stateChanged(QLowEnergyService::ServiceState             )),
                     this      , SLOT  ( serviceStateChanged(QLowEnergyService::ServiceState      )) );
            connect( m_service , SIGNAL( descriptorRead(QLowEnergyDescriptor,QByteArray)),
                     this      , SLOT  ( descriptorRead(QLowEnergyDescriptor,QByteArray)));
            qDebug()<<"Calling discoverDetails()";
            if ( m_service ) {
                  qDebug()<< "DiscoverDetails Service Name : " << m_service->serviceName();
                  qDebug()<< "DiscoverDetails Service UUID : " << m_service->serviceUuid();
                  qDebug() << "m_service is null";

  • Here is my debug low; I know it doesn't say much without the entire code.
    But it show which functions are called and which signals are fired by BLE Controller.

    Service Scan Finished. (QLowEnergyController::discoveryFinished)
    Available Services List :  ("{**00001523-1212-efde-1523-785feabcd123**}", "{00001800-0000-1000-8000-00805f9b34fb}", "{00001801-0000-1000-8000-00805f9b34fb}", "{0000180d-0000-1000-8000-00805f9b34fb}")
    QLowEnergyService Service Name :  "Unknown Service"
    QLowEnergyService Service UUID :  "{**00001523-1212-efde-1523-785feabcd123**}"
    Calling discoverDetails()
    ServiceState Changed : DiscoveringServices
    ServiceState Changed : DiscoveryRequired

    ServiceState does not become ServiceDiscovered for some reason.
    00001523-1212-efde-1523-785feabcd123 is the service that I want to use by the way.

Log in to reply