diff options
Diffstat (limited to 'src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp index 674302bf..ec8de3e8 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp @@ -365,7 +365,6 @@ QBluetoothDeviceDiscoveryAgent::DiscoveryMethods QBluetoothDeviceDiscoveryAgent: void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods methods) { - Q_Q(QBluetoothDeviceDiscoveryAgent); if (worker) return; @@ -378,12 +377,12 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent discoveredDevices.clear(); connect(worker, &QWinRTBluetoothDeviceDiscoveryWorker::initializationCompleted, this, &QBluetoothDeviceDiscoveryAgentPrivate::onListInitializationCompleted); + connect(worker, &QWinRTBluetoothDeviceDiscoveryWorker::leDeviceFound, + this, &QBluetoothDeviceDiscoveryAgentPrivate::onLeDeviceFound); connect(worker, &QWinRTBluetoothDeviceDiscoveryWorker::scanFinished, this, &QBluetoothDeviceDiscoveryAgentPrivate::onScanFinished); connect(worker, &QWinRTBluetoothDeviceDiscoveryWorker::scanCanceled, this, &QBluetoothDeviceDiscoveryAgentPrivate::onScanCanceled); - connect(worker, &QWinRTBluetoothDeviceDiscoveryWorker::leDeviceFound, - q, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered); worker->start(); if (lowEnergySearchTimeout > 0 && methods & QBluetoothDeviceDiscoveryAgent::LowEnergyMethod) { // otherwise no timeout and stop() required @@ -417,6 +416,17 @@ void QBluetoothDeviceDiscoveryAgentPrivate::onListInitializationCompleted() emit q->deviceDiscovered(info); } +void QBluetoothDeviceDiscoveryAgentPrivate::onLeDeviceFound(const QBluetoothDeviceInfo &info) +{ + Q_Q(QBluetoothDeviceDiscoveryAgent); + for (auto discoveredInfo : discoveredDevices) + if (discoveredInfo.address() == info.address()) + return; + + discoveredDevices << info; + emit q->deviceDiscovered(info); +} + void QBluetoothDeviceDiscoveryAgentPrivate::onScanFinished() { Q_Q(QBluetoothDeviceDiscoveryAgent); |