summaryrefslogtreecommitdiff
path: root/libsowatchbt/bluetoothwatchscanner.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-05-08 18:04:31 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-05-08 18:04:31 +0200
commitccd19d2b7ee4184503ea46b98333b27a5613190e (patch)
treef78cc3f3c946d7a4f8167f72fb20703c65494d84 /libsowatchbt/bluetoothwatchscanner.cpp
parent6003bf81107dd9be51589c074b74c5af82bfc8ab (diff)
downloadsowatch-ccd19d2b7ee4184503ea46b98333b27a5613190e.tar.gz
sowatch-ccd19d2b7ee4184503ea46b98333b27a5613190e.zip
big change: a new abstract BluetoothWatch class
Diffstat (limited to 'libsowatchbt/bluetoothwatchscanner.cpp')
-rw-r--r--libsowatchbt/bluetoothwatchscanner.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/libsowatchbt/bluetoothwatchscanner.cpp b/libsowatchbt/bluetoothwatchscanner.cpp
new file mode 100644
index 0000000..eeae5f7
--- /dev/null
+++ b/libsowatchbt/bluetoothwatchscanner.cpp
@@ -0,0 +1,31 @@
+#include <QtConnectivity/QBluetoothDeviceInfo>
+#include <QtConnectivity/QBluetoothAddress>
+
+#include "bluetoothwatchscanner.h"
+
+QTM_USE_NAMESPACE
+using namespace sowatch;
+
+BluetoothWatchScanner::BluetoothWatchScanner(QObject *parent) :
+ WatchScanner(parent),
+ _agent(new QBluetoothServiceDiscoveryAgent(this))
+{
+ connect(_agent, SIGNAL(finished()), this, SIGNAL(finished()));
+ connect(_agent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)),
+ this, SLOT(handleDiscoveredService(QBluetoothServiceInfo)));
+}
+
+void BluetoothWatchScanner::start()
+{
+ if (_agent->isActive()) {
+ _agent->stop();
+ }
+ _agent->start();
+ qDebug() << "started bluetooth scan";
+ emit started();
+}
+
+void BluetoothWatchScanner::setUuidFilter(const QBluetoothUuid & uuid)
+{
+ _agent->setUuidFilter(uuid);
+}