-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLcdClient.hpp
79 lines (64 loc) · 1.66 KB
/
LcdClient.hpp
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
#include <QtNetwork>
#include <QtCore>
#include <QDebug>
#include <QTime>
#include <QTimer>
#include <QFile>
#include <QTcpSocket>
#include <QHash>
#include <QNetworkAccessManager>
#include <QUrl>
#include <QJsonDocument>
#include <QProcess>
#include <QNetworkInterface>
#ifndef LCDCLIENT_H_
#define LCDCLIENT_H_
// One set of CPU load values
// for calculating the difference
typedef struct
{
unsigned long user;
unsigned long system;
unsigned long nice;
unsigned long idle;
unsigned long total;
} loadStruct;
class LcdClient : public QObject
{
Q_OBJECT
public:
explicit LcdClient(QObject *parent = nullptr);
private slots:
void update();
void handleHttpResponse(QNetworkReply *reply);
void readServerResponse();
void handleSocketError(QAbstractSocket::SocketError socketError);
private:
QTimer updateTimer;
QTcpSocket lcdSocket;
QFile fileTemp;
QFile fileStat;
QFile fileVoltAlarm;
QFile fileTempThrottle;
QNetworkAccessManager qnam;
QNetworkRequest request;
QProcess proc;
// Used to switch backlight either
// BLUE = all values of all universes = 0
// GREEN = some value in any universe != 0
int universeAllZeroes[8];
// Offest for each universe screen storing the
// first channel number to be displayed (0 based)
int universeOffset[8];
// Will add RED backlight if != 0
int machineProblem;
QString currentScreen;
loadStruct lastLoad;
QString getMachineIPs();
QString getMachineTemp();
QString getMachineCPULoad();
QString getRPiStatus();
void updateDmxUniverse(int universe);
void updateBacklight();
};
#endif // LCDCLIENT_H_