Fotobot
Get data from your photovoltaic plant
modbustcp.h
Go to the documentation of this file.
1 
7 #ifndef _MODBUSTCP_H_
8 #define _MODBUSTCP_H_
9 #include <QList>
10 #include <QDateTime>
11 #include <QTimer>
12 #include <QVariant>
13 
14 #include "invertor.h"
15 #include "fronius_response.h"
16 #include "qextserialport.h"
17 
18 class DBT_DATA;
19 
26 class MODBUSTCP : public INVERTOR {
27  Q_OBJECT
28  public:
29  MODBUSTCP();
30  ~MODBUSTCP();
31 
32  public slots:
33  void open();
34 
35 
36  private:
37 
38  private slots:
39  void slotInit();
40  void slotQuit();
41  void loop();
42 
43  private:
44 
45  QTimer *m_timer;
46  quint16 m_frameid;
47 
48  void readInvertor();
49  void readInvertorInfo(const DBT_INVERTORS& invertor);
50  QByteArray readModbus(const DBT_INVERTORS& invertor, quint16 regaddress, quint16 regcnt, quint16 expectedLength);
51 
52  void incrementFrameId() { m_frameid++; }
53 
54  float float32(const QByteArray& data, int offset) const;
55  qint16 integer16(const QByteArray& data, int offset) const;
56  qint32 integer32(const QByteArray& data, int offset) const;
57 
59  int m_number_of_ok;
60  int m_number_of_err;
61 
62  QString stateToString(int);
63  QString exceptionCodeToString(int);
64 
65 
66 
67 };
68 
69 #endif
Communicates with invertors using serial port.
Definition: modbustcp.h:26
MODBUSTCP()
Constructor. The very basic initializations.
Definition: modbustcp.cpp:35
void data(DBT_DATA)
Signal to send retrieved data to other objects.
void open()
Opens serial port.
Definition: modbustcp.cpp:79
Class describing database table DATA.
void slotInit()
Function called within running thread to initialize all needed child objects.
Definition: modbustcp.cpp:51
Virtual class for invertor communication.
Definition: invertor.h:28
int m_current_invertor_index
Current index in INVERTOR::m_invertors list.
Definition: modbustcp.h:58
void loop()
Loops the invertors's list.
Definition: modbustcp.cpp:96
Class describing database table INVERTORS.