From 5254e62e1898cffe397ecd0b0c8be43213e5b4e8 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 21 Jan 2014 16:00:01 +0100 Subject: Stop SDP search if QML Model is turned off So far, we only ever disabled the device search. If a SDP discovery was running and we changed to device discovery the SDP discovery kept running in the background. Change-Id: I5f2cf88ecf7f9b5cfe2608e0ceda366b552982e5 Reviewed-by: Fabian Bumberger --- src/bluetooth/qbluetoothservicediscoveryagent.cpp | 3 +++ src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.cpp b/src/bluetooth/qbluetoothservicediscoveryagent.cpp index 87ccb108..beaa3503 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent.cpp @@ -266,6 +266,9 @@ void QBluetoothServiceDiscoveryAgent::stop() { Q_D(QBluetoothServiceDiscoveryAgent); + if (!isActive()) + return; + switch (d->discoveryState()) { case QBluetoothServiceDiscoveryAgentPrivate::DeviceDiscovery: d->stopDeviceDiscovery(); diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp index 6689d663..b7534329 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp @@ -367,11 +367,10 @@ void QDeclarativeBluetoothDiscoveryModel::setRunning(bool running) d->m_running = running; if (!running) { - if (d->m_deviceAgent) { + if (d->m_deviceAgent) d->m_deviceAgent->stop(); - } else if (d->m_serviceAgent) { + if (d->m_serviceAgent) d->m_serviceAgent->stop(); - } } else { clearModel(); d->m_error = NoError; -- cgit v1.2.3