summaryrefslogtreecommitdiff
path: root/gatocentralmanager.h
blob: 7ebe2cf9c8e057388a672782ed9687d6e8621526 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef GATOCENTRALMANAGER_H
#define GATOCENTRALMANAGER_H

#include <QtCore/QObject>
#include "libgato_global.h"
#include "gatouuid.h"

class GatoPeripheral;
class GatoAddress;
class GatoCentralManagerPrivate;

class LIBGATO_EXPORT GatoCentralManager : public QObject
{
	Q_OBJECT
	Q_DECLARE_PRIVATE(GatoCentralManager)
	Q_FLAGS(PeripheralScanOptions)

public:
	explicit GatoCentralManager(QObject *parent = 0);
	~GatoCentralManager();

	enum PeripheralScanOption {
		PeripheralScanOptionActive = 1 << 0,
		PeripheralScanOptionAllowDuplicates = 1 << 1
	};
	Q_DECLARE_FLAGS(PeripheralScanOptions, PeripheralScanOption)

	GatoPeripheral *getPeripheral(const GatoAddress& address);

public slots:
	void scanForPeripherals(PeripheralScanOptions options = 0);
	void scanForPeripheralsWithServices(const QList<GatoUUID>& uuids, PeripheralScanOptions options = 0);
	void stopScan();

signals:
	void discoveredPeripheral(GatoPeripheral *peripheral, int rssi);

private slots:
	void _q_readNotify();

private:
	GatoCentralManagerPrivate *const d_ptr;
};

Q_DECLARE_OPERATORS_FOR_FLAGS(GatoCentralManager::PeripheralScanOptions)

#endif // GATOCENTRALMANAGER_H