-
Notifications
You must be signed in to change notification settings - Fork 2
/
ws2client.h
41 lines (34 loc) · 867 Bytes
/
ws2client.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 WSCLIENT_H
#define WSCLIENT_H
#include <QtCore/QObject>
#include <QtWebSockets/QWebSocket>
#include <QTimer>
#include <QObject>
#include <QThread>
#include <QJsonDocument>
#include <QJsonValue>
#include <QJsonObject>
class Ws2Client : public QObject
{
Q_OBJECT
public:
explicit Ws2Client(QObject *parent = nullptr);
public Q_SLOTS:
void startConnection();
void updateValue(qint8 value);
private Q_SLOTS:
void onConnected();
void onDisconnected();
void onTextMessageReceived(QString message);
void onWakeupTimer1Timeout();
void onWakeupTimer2Timeout();
void onStopTimerTimeout();
private:
QWebSocket *webSocket;
QTimer *wakeupTimer1;
QTimer *wakeupTimer2;
QTimer *stopTimer;
bool initialized = false;
QString session = "0";
};
#endif // WSCLIENT_H