Increasing the Scan time for QBluetoothDeviceDiscoveryAgent::Start()



  • Hi,
    I am trying to develop a Bluetooth Application and I am using QBluetoothDeviceDiscoveryAgent::Start() to discover visible bluetooth devices.
    It works well but my problem is that, i would like the scanning to either run for a longer period or until a user double-clicks on a device detected.

    By default, I think Start() has a scan time of 10.28 seconds.

    I tried reading through the header files but can't seem to find any solution.

    Would be please if I can be assisted.

    Thank you



  • I am not sure if this is configurable, but if not, you could just rescan again



  • Thanks for your response ;)
    Please how do I rescan again?
    Is it by using QTimer or using loops since I call Start() after connecting to deviceDiscovered() signal?



  • You can connect finished signal to an slot that keeps counting the times you have scanned, let's say you want to do it for a minute, so in that slot you would call start if your counter is less than 6, or something like that, hope that helps



  • Oh ok, can you please give me an example..

    connect(discov,SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)),this,SLOT(detectedDevice(QBluetoothDeviceInfo)));
        connect(discov, SIGNAL(finished()), discov, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo));
        connect(discov, SIGNAL(canceled()), this, SLOT(scanCompleted()));
        //Begin Device discovery
        discov->start();
    

    my deviceDiscovered(QBluetoothDeviceInfo) is used to update my QTableWidget


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.