-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebsocketserver.h
63 lines (46 loc) · 1.24 KB
/
websocketserver.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef WEBSOCKETSERVER_H
#define WEBSOCKETSERVER_H
#include <QObject>
#include <QWebSocketServer>
#include <QWebSocket>
#include "InputEvent.h"
#include "jsonhelper.h"
#include "mouse.h"
#include "keyboard.h"
#include "networkhelper.h"
#ifdef Q_OS_WIN
#include <windows.h>
#endif
#ifdef Q_OS_LINUX
#include <X11/Xlib.h>
#include <X11/extensions/XTest.h>
#endif
class WebSocketServer : public QObject {
Q_OBJECT
public:
explicit WebSocketServer(quint16 port, QObject *parent = nullptr);
~WebSocketServer();
private slots:
void onNewConnection();
void processTextMessage(QString message);
void socketDisconnected();
void auth(QString);
private:
QWebSocketServer *m_pWebSocketServer;
QWebSocket *pSocket;
NetworkHelper *networkHelper;
QWebSocketCorsAuthenticator *corsAuth;
QList<QWebSocket *> m_clients;
InputEventType inputEventType;
JsonHelper *jsonhelper;
Mouse *mouse;
Keyboard *keyboard;
Mouse::Point *point;
bool isAuthenticated;
#ifdef Q_OS_LINUX
Display *display; // Linux için X11 Display
#endif
void handleMouseInput(Mouse::Point*, Mouse::ActionType,Mouse::ClickType);
void handleKeyboardInput(int key, Keyboard::ActionType);
};
#endif // WEBSOCKETSERVER_H