diff options
Diffstat (limited to 'libsowatchbt/bluetoothwatchscanner.cpp')
-rw-r--r-- | libsowatchbt/bluetoothwatchscanner.cpp | 31 |
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); +} |