forked from obsproject/obs-websocket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWSRequestHandler.h
More file actions
91 lines (73 loc) · 3.28 KB
/
WSRequestHandler.h
File metadata and controls
91 lines (73 loc) · 3.28 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
obs-websocket
Copyright (C) 2016 Stéphane Lepin <stephane.lepin@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <https://www.gnu.org/licenses/>
*/
#ifndef WSREQUESTHANDLER_H
#define WSREQUESTHANDLER_H
#include <QtWebSockets/QWebSocket>
#include <obs-frontend-api.h>
class WSRequestHandler : public QObject
{
Q_OBJECT
public:
explicit WSRequestHandler(QWebSocket *client);
~WSRequestHandler();
void sendTextMessage(QString textMessage);
bool isAuthenticated();
private Q_SLOTS:
void processTextMessage(QString textMessage);
void socketDisconnected();
Q_SIGNALS:
void disconnected();
private:
QWebSocket *_client;
bool _authenticated;
const char *_messageId;
const char *_requestType;
obs_data_t *_requestData;
QMap<QString, void(*)(WSRequestHandler*)> messageMap;
QSet<QString> authNotRequired;
void SendOKResponse(obs_data_t *additionalFields = NULL);
void SendErrorResponse(const char *errorMessage);
static void ErrNotImplemented(WSRequestHandler *owner);
static void HandleGetVersion(WSRequestHandler *owner);
static void HandleGetAuthRequired(WSRequestHandler *owner);
static void HandleAuthenticate(WSRequestHandler *owner);
static void HandleSetCurrentScene(WSRequestHandler *owner);
static void HandleGetCurrentScene(WSRequestHandler *owner);
static void HandleGetSceneList(WSRequestHandler *owner);
static void HandleSetSourceRender(WSRequestHandler *owner);
static void HandleSetSceneItemPosition(WSRequestHandler *owner);
static void HandleSetSceneItemTransform(WSRequestHandler *owner);
static void HandleGetStreamingStatus(WSRequestHandler *owner);
static void HandleStartStopStreaming(WSRequestHandler *owner);
static void HandleStartStopRecording(WSRequestHandler *owner);
static void HandleGetTransitionList(WSRequestHandler *owner);
static void HandleGetCurrentTransition(WSRequestHandler *owner);
static void HandleSetCurrentTransition(WSRequestHandler *owner);
static void HandleSetVolume(WSRequestHandler *owner);
static void HandleGetVolume(WSRequestHandler *owner);
static void ToggleMute(WSRequestHandler *owner);
static void SetMute(WSRequestHandler *owner);
//my self
static void HandleSetCurrentProfile(WSRequestHandler *owner);
static void HandleGetCurrentProfile(WSRequestHandler *owner);
static void HandleStartStreaming(WSRequestHandler *owner);
static void HandleStopStreaming(WSRequestHandler *owner);
static void HandleUpdateService(WSRequestHandler *owner);
static void HandleUpdateSourceString(WSRequestHandler *owner);
static void HandleUpdateSourceInt(WSRequestHandler *owner);
static void HandleUpdateSourceBool(WSRequestHandler *owner);
static void HandleUpdateSourceDouble(WSRequestHandler *owner);
};
#endif // WSPROTOCOL_H