summaryrefslogtreecommitdiff
path: root/sapbtlistener.h
blob: 3fe821d63a9c04106c71c366b01b926058009c25 (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
48
49
50
#ifndef SAPBTLISTENER_H
#define SAPBTLISTENER_H

#include <QtCore/QObject>

#if QT_VERSION >= QT_VERSION_CHECK(5,2,0)
#include <QtBluetooth/QBluetoothServer>
#include <QtBluetooth/QBluetoothServiceInfo>
#elif QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <QtBluetooth/QRfcommServer>
#include <QtBluetooth/QBluetoothServiceInfo>
QT_USE_NAMESPACE_BLUETOOTH
#else
#include <QtConnectivity/QRfcommServer>
#include <QtConnectivity/QBluetoothServiceInfo>
QTM_USE_NAMESPACE
#endif

class SAPBTListener : public QObject
{
	Q_OBJECT
public:
	explicit SAPBTListener(QObject *parent = 0);
	~SAPBTListener();

signals:

public slots:
	void start();
	void stop();

	void nudge(const QBluetoothAddress &address);

private:

private slots:
	void acceptConnection();
	void handleNudgeError(QBluetoothSocket::SocketError error);


private:
#if QT_VERSION >= QT_VERSION_CHECK(5,2,0)
	QBluetoothServer *_server;
#else
	QRfcommServer *_server;
#endif
	QBluetoothServiceInfo _service;
};

#endif // SAPBTLISTENER_H