summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/lowenergyscanner/device.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-10-28 11:42:34 +0100
committerAlex Blasche <alexander.blasche@digia.com>2014-10-28 13:51:15 +0100
commit0b42f1e6f6be36a23584dfe41acaf414023f747a (patch)
tree0edc4814ad2c4d31b12a505adfee1566279b1ca8 /examples/bluetooth/lowenergyscanner/device.cpp
parent4591068fe2d637b6dee7cab62e565613a8cbc91a (diff)
Fix lowenergyscanner when dealing with device scan errors
Previously the error was indicated but other UI elements were still giving the impression that the scan was ongoing. Change-Id: Iafab8f43bff3303eb6ad5e3385db2f81288d2e66 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'examples/bluetooth/lowenergyscanner/device.cpp')
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index 215a7588..acab48c2 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -86,8 +86,11 @@ void Device::startDeviceDiscovery()
//! [les-devicediscovery-2]
discoveryAgent->start();
//! [les-devicediscovery-2]
- m_deviceScanState = true;
- Q_EMIT stateChanged();
+
+ if (discoveryAgent->isActive()) {
+ m_deviceScanState = true;
+ Q_EMIT stateChanged();
+ }
}
//! [les-devicediscovery-3]
@@ -302,6 +305,10 @@ void Device::deviceScanError(QBluetoothDeviceDiscoveryAgent::Error error)
setUpdate("Writing or reading from the device resulted in an error.");
else
setUpdate("An unknown error has occurred.");
+
+ m_deviceScanState = false;
+ emit devicesUpdated();
+ emit stateChanged();
}
bool Device::state()