summaryrefslogtreecommitdiff
path: root/libsowatchbt/bluetoothwatchscanner.cpp
blob: eeae5f725bfc9911d92c9f351e59c98c5ecbfe95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);
}