Fotobot
Get data from your photovoltaic plant
fronius_response.h
Go to the documentation of this file.
1 
7 #ifndef _FRONIUS_response_H_
8 #define _FRONIUS_response_H_
9 
10 #include <math.h>
11 #include <QCoreApplication>
12 #include <QString>
13 #include <QVariant>
14 
15 
20  Q_DECLARE_TR_FUNCTIONS(FRONIUS_response);
21  public:
22  unsigned char hdr0;
23  unsigned char hdr1;
24  unsigned char hdr2;
25  unsigned char length;
26  unsigned char device_option;
27  unsigned char device_number;
28  unsigned char command;
29 
30  union {
31  unsigned char buffer[255];
32 
36  struct {
37  unsigned char failedCommand;
38  unsigned char errorInformation;
39  unsigned char checksum;
40  } Error;
41 
45  struct {
46  unsigned char ifcType;
47  unsigned char versionMajor;
48  unsigned char versionMinor;
49  unsigned char versionRelease;
50  unsigned char checksum;
51  } Version;
52 
56  struct {
57  unsigned char typeIdentification;
58  unsigned char checksum;
59  } DeviceType;
60 
64  struct {
65  unsigned char activeInvertor;
66  unsigned char checksum;
68 
72  struct {
73  unsigned char msb;
74  unsigned char lsb;
75  unsigned char exponent;
76  unsigned char checksum;
77  } Value;
78 
82  struct {
83  unsigned char status;
84  unsigned char checksum;
85  } Status;
86 
87  } buffer;
88 
89 
90  const unsigned char static HEADER_LENGTH = 7;
91 
93 
94  bool isChecksumValid();
95  bool isHeaderValid();
96  QVariant value();
97 
98  private:
99  unsigned char checksum() ;
100 
101 };
102 
103 
104 #endif
struct FRONIUS_response::@0::@3 DeviceType
Structure of data payload when answering to devicetype command.
QVariant value()
Decodes and returns value stored in response.
Response from fronius invertor.
struct FRONIUS_response::@0::@6 Status
Structure of data payload when answering status command.
unsigned char checksum
Returns checksum of the response.
struct FRONIUS_response::@0::@4 ActiveInvertor
Structure of data payload when answering to active invertors command.
bool isChecksumValid()
Check header validity.
struct FRONIUS_response::@0::@5 Value
Structure of data payload when answering command requesting a value.
bool isHeaderValid()
Check header validity.
struct FRONIUS_response::@0::@2 Version
Structure of data payload when answering to version command.
struct FRONIUS_response::@0::@1 Error
Structure of data payload when an error occured.