Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

DiscoveryAgent so slow compared to hcitool lescan



  • Hi,

    are there any plans in improving the bluez usage. Comparing the discoveryagent against the hcitool lescan it the qt implementation is far slower. And by the way incorporates a lot of cached devices. Is it some how possible that qt switches to the hcitool for scanning. Or at least copies the dbus calls from this tool.

    Thanks in advance.

    Cheers


  • Qt Champions 2019

    @abeat You should ask Qt developers on their mailing list. This is user forum.



  • Solved it by using bt-device in a QProcess to remove all cached devices. Seems to work properly.
    For everybody interested I used it as followed before each scan Start:

    QString info = QSysInfo::kernelType();
    if (info.contains("linux")){
        QProcess process;
        process.start("bt-device -l");
        process.waitForFinished();
        QString output(process.readAllStandardOutput());
        
        // Add device token of interest
        QRegExp rx("((XXX|XX)_[\\da-f]{6})\\s");
        QStringList list;
        int pos = 0;
        
        // go through all devices
        while ((pos = rx.indexIn(output, pos)) != -1) {
            list << rx.cap(1);
            pos += rx.matchedLength();
        }
    
        for (int i = 0; i < list.size(); i++){
            if (!m_qlConnectedDevices.contains(list.at(i))){
                process.start("bt-device -r " + list.at(i));
                process.waitForFinished();
                QString output(process.readAllStandardOutput());
            }
        }
    }

Log in to reply