summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/lowenergyscanner/device.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bluetooth/lowenergyscanner/device.cpp')
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index df125d60..44cd3512 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -51,7 +51,7 @@
#include <QList>
Device::Device():
- connected(false), info(0)
+ connected(false), info(0), m_deviceScanState(false)
{
discoveryAgent = new QBluetoothDeviceDiscoveryAgent();
connect(discoveryAgent, SIGNAL(deviceDiscovered(const QBluetoothDeviceInfo&)),
@@ -89,6 +89,8 @@ void Device::startDeviceDiscovery()
devices.clear();
setUpdate("Scanning for devices ...");
discoveryAgent->start();
+ m_deviceScanState = true;
+ Q_EMIT stateChanged();
}
void Device::addDevice(const QBluetoothDeviceInfo &info)
@@ -103,6 +105,8 @@ void Device::addDevice(const QBluetoothDeviceInfo &info)
void Device::scanFinished()
{
Q_EMIT devicesDone();
+ m_deviceScanState = false;
+ Q_EMIT stateChanged();
if (devices.isEmpty())
setUpdate("No Low Energy devices found...");
else
@@ -233,3 +237,8 @@ void Device::serviceScanError(QBluetoothServiceDiscoveryAgent::Error error)
else
setUpdate("An unknown error has occurred.");
}
+
+bool Device::state()
+{
+ return m_deviceScanState;
+}