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. qtconnectivity "Device discovery aborted due to unexpected adapter changes"
Qt 6.11 is out! See what's new in the release blog

qtconnectivity "Device discovery aborted due to unexpected adapter changes"

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.5k Views 2 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.
  • H Offline
    H Offline
    Haponov
    wrote on last edited by Haponov
    #1

    this error happens from time to time (on Ubuntu and Raspbian) while trying to repeatedly scan for BLE devices with deviceDiscoveryAgent
    using http://doc.qt.io/qt-5/qbluetoothdevicediscoveryagent.html#QBluetoothDeviceDiscoveryAgent-1 like this:

    #include "controller.h"
    #include <QDebug>

    Controller::Controller(QObject *parent) : QObject(parent)
    {
    qDebug()<<"found " <<QBluetoothLocalDevice::allDevices().size()<<" devices";
    for (int i=0; i<QBluetoothLocalDevice::allDevices().size(); ++i)
    {
    qDebug()<< QString ("dongle found, address - %1").arg(QBluetoothLocalDevice::allDevices().at(i).address().toString());
    }

    m_deviceDiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
    
    connect(m_deviceDiscoveryAgent, SIGNAL(deviceDiscovered(const QBluetoothDeviceInfo&)),
            this, SLOT(foundDevice(const QBluetoothDeviceInfo&)));
    connect(m_deviceDiscoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)),
            this, SLOT(deviceScanError(QBluetoothDeviceDiscoveryAgent::Error)));
    connect(m_deviceDiscoveryAgent, SIGNAL(finished()), this, SLOT(scanFinished()));
    m_deviceDiscoveryAgent->start();
    

    }

    void Controller::foundDevice(const QBluetoothDeviceInfo &beacon)
    {
    if (beacon.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration)
    {
    qWarning() << "Discovered LE Device name: " << beacon.name() << " Address: " << beacon.address().toString()
    << "rssi "<<beacon.rssi();
    }
    }

    void Controller::deviceScanError(QBluetoothDeviceDiscoveryAgent::Error)
    {
    qWarning() << "and here errors go";
    }

    void Controller::scanFinished()
    {
    qDebug()<< "!!scan finished!!-------------------";
    m_deviceDiscoveryAgent->stop();
    QTimer::singleShot(2000, this, SLOT(startScan()));
    }

    void Controller::startScan()
    {
    qDebug()<< "==================scan started again=================";
    qDebug()<<"list of discovered devices is empty - "
    << m_deviceDiscoveryAgent->discoveredDevices().isEmpty();
    m_deviceDiscoveryAgent->start();
    }

    and such an error is nowhere on the internet except for sites like http://code.qt.io/cgit/qt/qtconnectivity.git/commit/?id=5382ada3cb21cfa2721e4f50ced2d288c156018b
    can anyone explain what it means?

    1 Reply Last reply
    0
    • ThofT Offline
      ThofT Offline
      Thof
      wrote on last edited by
      #2

      Have you found a solution? I'm in the same situation and looking for a stable solution!

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Haponov
        wrote on last edited by
        #3

        No. I gave up searching devices with QBluetoothDeviceDiscoveryAgent, as it does not seem "to like" being stopped and started again in the same thread. And frankly speaking stopping/starting it is useless.

        Instead I go with bluez "hcitool lescan" in QProcess

        1 Reply Last reply
        0
        • AlexBlascheA Offline
          AlexBlascheA Offline
          AlexBlasche
          wrote on last edited by
          #4

          The fix for this bug is stated in https://bugreports.qt.io/browse/QTBUG-53715. Next target are 5.6.2 and 5.7.1. Should be easy to cherry-pick as well.

          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