delay discovery restarts a bit so that we don't end up in a busy loop if the adapter is busy
parent
82c10cb03f
commit
fa9ef3ef25
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "discoverymodel.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
BluetoothServiceDiscovery::BluetoothServiceDiscovery(DiscoveryModel *discoveryModel, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_discoveryModel(discoveryModel)
|
||||
|
|
@ -45,7 +47,11 @@ void BluetoothServiceDiscovery::discover()
|
|||
qDebug() << "BluetoothServiceDiscovery: Start scanning for service" << m_nymeaServiceUuid.toString();
|
||||
setDiscovering(true);
|
||||
m_serviceDiscovery->setUuidFilter(m_nymeaServiceUuid);
|
||||
m_serviceDiscovery->start(QBluetoothServiceDiscoveryAgent::FullDiscovery);
|
||||
|
||||
// Delay restarting as Bluez might not be ready just yet
|
||||
QTimer::singleShot(500, this, [this]() {
|
||||
m_serviceDiscovery->start(QBluetoothServiceDiscoveryAgent::FullDiscovery);
|
||||
});
|
||||
}
|
||||
|
||||
void BluetoothServiceDiscovery::stopDiscovery()
|
||||
|
|
|
|||
Loading…
Reference in New Issue