-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvertercomm.hpp
59 lines (43 loc) · 1.11 KB
/
invertercomm.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
#ifndef INVERTESOCKET_HPP
#define INVERTESOCKET_HPP
#include <QTcpSocket>
#include <QString>
#include <QList>
#include <QPair>
#include "inverterdata.hpp"
class InverterComm: public QObject
{
Q_OBJECT
public:
explicit InverterComm(QObject *parent = 0);
~InverterComm();
QString getQuery() const;
void setQuery(const QString& value);
int getPort() const;
void setPort(int value);
QString getIp() const;
void setIp(const QString& value);
int getId() const;
void setId(int value);
private:
QString ip;
int port;
int id;
QString query;
bool running;
QTcpSocket* sock;
QString prepareQuery();
bool checkInvParams();
QString checksum(QString input);
void parseResponse(QByteArray data);
void closeSocket();
signals:
void newResponse(InverterData);
private slots:
void writeNewQuery();
void readResponse();
void resetRunning();
public slots:
void sendNewQuery();
};
#endif // INVERTESOCKET_HPP