summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2017-10-17 07:50:11 +0200
committerAlex Blasche <alexander.blasche@qt.io>2017-10-17 07:50:11 +0200
commit013ad0570844975cd5c72a77d1cfefa30c3ea656 (patch)
tree9fb1d5afc8b29f97a60ca20d514269b9d1658ef2 /src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
parent18af3226765b62312acc8f801cc531fde0d9822b (diff)
parent80d85141aa496583c5cfa6dd0f62d5eb4a8ba660 (diff)
Merge remote-tracking branch 'gerrit/5.9' into 5.10v5.10.0-beta3
Diffstat (limited to 'src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp')
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
index e9641344..6786ac54 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
@@ -108,7 +108,7 @@ private:
HRESULT onBluetoothLEDeviceFound(ComPtr<IBluetoothLEDevice> device, PairingCheck pairingCheck = CheckForPairing);
public slots:
- void handleLeTimeout();
+ void finishDiscovery();
Q_SIGNALS:
void deviceFound(const QBluetoothDeviceInfo &info);
@@ -257,7 +257,7 @@ void QWinRTBluetoothDeviceDiscoveryWorker::setupLEDeviceWatcher()
Q_ASSERT_SUCCEEDED(hr);
}
-void QWinRTBluetoothDeviceDiscoveryWorker::handleLeTimeout()
+void QWinRTBluetoothDeviceDiscoveryWorker::finishDiscovery()
{
emit scanFinished();
deleteLater();
@@ -273,6 +273,9 @@ void QWinRTBluetoothDeviceDiscoveryWorker::classicBluetoothInfoFromDeviceIdAsync
HRESULT hr = m_deviceStatics->FromIdAsync(deviceId, &deviceFromIdOperation);
if (FAILED(hr)) {
--m_pendingPairedDevices;
+ if (!m_pendingPairedDevices
+ && !(requestedModes & QBluetoothDeviceDiscoveryAgent::LowEnergyMethod))
+ finishDiscovery();
qCWarning(QT_BT_WINRT) << "Could not obtain bluetooth device from id";
return S_OK;
}
@@ -281,6 +284,9 @@ void QWinRTBluetoothDeviceDiscoveryWorker::classicBluetoothInfoFromDeviceIdAsync
(this, &QWinRTBluetoothDeviceDiscoveryWorker::onPairedClassicBluetoothDeviceFoundAsync).Get());
if (FAILED(hr)) {
--m_pendingPairedDevices;
+ if (!m_pendingPairedDevices
+ && !(requestedModes & QBluetoothDeviceDiscoveryAgent::LowEnergyMethod))
+ finishDiscovery();
qCWarning(QT_BT_WINRT) << "Could not register device found callback";
return S_OK;
}
@@ -396,6 +402,8 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onPairedClassicBluetoothDeviceFoun
QMetaObject::invokeMethod(this, "deviceFound", Qt::AutoConnection,
Q_ARG(QBluetoothDeviceInfo, info));
+ if (!m_pendingPairedDevices && !(requestedModes & QBluetoothDeviceDiscoveryAgent::LowEnergyMethod))
+ finishDiscovery();
return S_OK;
}
@@ -566,7 +574,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent
leScanTimer->setSingleShot(true);
}
connect(leScanTimer, &QTimer::timeout,
- worker, &QWinRTBluetoothDeviceDiscoveryWorker::handleLeTimeout);
+ worker, &QWinRTBluetoothDeviceDiscoveryWorker::finishDiscovery);
leScanTimer->setInterval(lowEnergySearchTimeout);
leScanTimer->start();
}
@@ -629,7 +637,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::disconnectAndClearWorker()
q, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered);
if (leScanTimer) {
disconnect(leScanTimer, &QTimer::timeout,
- worker, &QWinRTBluetoothDeviceDiscoveryWorker::handleLeTimeout);
+ worker, &QWinRTBluetoothDeviceDiscoveryWorker::finishDiscovery);
}
worker.clear();
}