From ccd19d2b7ee4184503ea46b98333b27a5613190e Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Wed, 8 May 2013 18:04:31 +0200 Subject: big change: a new abstract BluetoothWatch class --- libsowatchbt/bluetoothwatchscanner.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 libsowatchbt/bluetoothwatchscanner.cpp (limited to 'libsowatchbt/bluetoothwatchscanner.cpp') 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 +#include + +#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); +} -- cgit v1.2.3