forked from jm-szlendak/scada_hmi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hmi_client.h
50 lines (40 loc) · 1.19 KB
/
hmi_client.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
42
43
44
45
46
47
48
49
50
#ifndef HMI_CLIENT_H
#define HMI_CLIENT_H
#include <QObject>
#include <QTcpSocket>
#include "common/scadadevice.h"
#include "common/humanmachineinterface.h"
#include "common/packet.h"
#include "deviceinterface.h"
#include "sensorinterface.h"
class HMI_Client : public QObject
{
Q_OBJECT
public:
HMI_Client();
~HMI_Client();
void connectToServer(QString hostName, int portNumber);
bool disconnectFromServer();
QList<DeviceInterface*>* getDeviceList();
ScadaDevice* findDevice(int uuid);
void appendToWishList(ScadaDevice* device);
void sendWishlist();
private:
QTcpSocket *socket;
HumanMachineInterface* hmi;
QList<DeviceInterface*> *deviceList;
// HumanMachineInterface* hmi;
public slots:
void onConnected();
void onDisconnected();
void switchDeviceState(DeviceInterface *device, bool state);
private slots:
void onDataReceived();
void onSocketError(QAbstractSocket::SocketError error);
signals:
void deviceListChanged(DeviceInterface* device); //for UI to handle new devices
void connectionFailed(QAbstractSocket::SocketError error);
void connectedToServer();
void disconnectedFromServer();
};
#endif // HMI_CLIENT_H