forked from krogank9/WifiMouseServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabstractedserver.h
executable file
·48 lines (37 loc) · 968 Bytes
/
abstractedserver.h
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
#ifndef ABSTRACTEDSERVER_H
#define ABSTRACTEDSERVER_H
#include <QTcpServer>
#include <QBluetoothServer>
#include <QBluetoothServiceInfo>
#include <QEventLoop>
#include <QTimer>
#include "abstractedsocket.h"
class AbstractedServer : public QObject
{
Q_OBJECT
public:
AbstractedServer();
~AbstractedServer();
AbstractedSocket *nextPendingConnection();
void listenWithTimeout(qint16 timeoutMs);
void trySetupServers();
QString pendingSocketInfo;
bool pendingIsBluetooth;
private:
QEventLoop eventLoop;
QTimer timeoutTimer;
bool registerBluetoothService();
bool bluetoothServerListen();
bool tcpServerListen();
QBluetoothServer bluetoothServer;
QBluetoothServiceInfo serviceInfo;
QTcpServer tcpServer;
QIODevice *pendingSocket;
public slots:
void newTcpConnection();
void newBluetoothConnection();
void timeout();
signals:
void newConnection();
};
#endif // ABSTRACTEDSERVER_H