-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebserver.h
41 lines (32 loc) · 891 Bytes
/
webserver.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
#ifndef WEBSERVER_H
#define WEBSERVER_H
#include <QImage>
#include <QObject>
#include <QReadWriteLock>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QObject>
#include <QtNetwork/QSslError>
#include <QBuffer>
QT_FORWARD_DECLARE_CLASS(QWebSocketServer)
QT_FORWARD_DECLARE_CLASS(QWebSocket)
class Webserver : public QObject {
Q_OBJECT
public:
explicit Webserver(quint16 port, QObject *parent = nullptr);
~Webserver();
Q_SIGNALS:
void commandReceived(const QString& command);
public Q_SLOTS:
void onCameraImageAvailable(const QImage &image);
private Q_SLOTS:
void onNewConnection();
void socketDisconnected();
void onTextMessageReceived(const QString &message);
void onSslErrors(const QList<QSslError> &errors);
private:
QWebSocketServer *m_pWebSocketServer;
QList<QWebSocket *> m_clients;
QReadWriteLock lock;
};
#endif // WEBSERVER_H