-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebsocketclient.h
More file actions
86 lines (60 loc) · 2 KB
/
websocketclient.h
File metadata and controls
86 lines (60 loc) · 2 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
#ifndef WEBSOCKETCLIENT_H
#define WEBSOCKETCLIENT_H
#include <QObject>
#include <QtWebSockets/QtWebSockets>
enum class WSCommand {
START,
PAUSE,
RESUME,
FINISH,
SETTIMERONOFF,
SETTIMERTIME,
UPDATE
};
class WebSocketClient : public QObject
{
Q_OBJECT
public:
WebSocketClient(const QUrl url);
// void sendStart();
// void sendPauseStart();
// void sendPauseFinish();
// void sendResume();
// void sendFinish();
// void sendEnableTimer(bool onOff);
// void sendSetTimerTime();
// void sendProgreeUpdate(int progress);
// void fileSave(QString name,QByteArray hello);
signals:
void downloadFiles(QString byte);
void startByWeb(QVariantList args);
void changeStateByWeb(QString state);
// void pauseByWeb();
// void resumeByWeb();
// void finishByWeb();
void getMaterialListbyWeb();
void getPrintInfoByWeb();
public slots:
void updateProgressToWeb(int progress); //update Progress
// void sendToUIFirstlayerStart(); //For CAL PrintTime
// void sendToUIFirstlayerFinish(); //For CAL PrintTime
void changeToPrintToWeb(); //change ui Ready to Print
void changeToStateToWeb(QString state);
void changeToPrintSettingErrorToWeb(int code); //print setting Error when received print start from UI
void enableTimer(bool enable); //for enabel Timer
void setTotalTime(int time);
void materialListToWeb(QVariantList name); //Material List UI must insert Custm resin when resin.json exist
void getPrintInfoToWeb(QString printerState,QString material, QString fileName,double layerHeight,int elapsedTime,int totalTime,int progress,bool enableTimer);
void open();
void closed();
void onConnected();
void onTextMessageReceived(QString message);
void error(QAbstractSocket::SocketError error);
private:
QWebSocket *_webSocket;
QString _socket_name;
QUrl _url;
bool _debug = true;
bool _connected = false;
};
#endif // WEBSOCKETCLIENT_H