Fotobot
Get data from your photovoltaic plant
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
FRONIUS_response Class Reference

Response from fronius invertor. More...

#include <fronius_response.h>

Public Member Functions

bool isChecksumValid ()
 Check header validity. More...
 
bool isHeaderValid ()
 Check header validity. More...
 
QVariant value ()
 Decodes and returns value stored in response.
 

Public Attributes

unsigned char hdr0
 
unsigned char hdr1
 
unsigned char hdr2
 
unsigned char length
 
unsigned char device_option
 
unsigned char device_number
 
unsigned char command
 
union {
   unsigned char   buffer [255]
 
   struct {
      unsigned char   failedCommand
 
      unsigned char   errorInformation
 
      unsigned char   checksum
 
   }   Error
 Structure of data payload when an error occured.
 
   struct {
      unsigned char   ifcType
 
      unsigned char   versionMajor
 
      unsigned char   versionMinor
 
      unsigned char   versionRelease
 
      unsigned char   checksum
 
   }   Version
 Structure of data payload when answering to version command.
 
   struct {
      unsigned char   typeIdentification
 
      unsigned char   checksum
 
   }   DeviceType
 Structure of data payload when answering to devicetype command.
 
   struct {
      unsigned char   activeInvertor
 
      unsigned char   checksum
 
   }   ActiveInvertor
 Structure of data payload when answering to active invertors command.
 
   struct {
      unsigned char   msb
 
      unsigned char   lsb
 
      unsigned char   exponent
 
      unsigned char   checksum
 
   }   Value
 Structure of data payload when answering command requesting a value.
 
   struct {
      unsigned char   status
 
      unsigned char   checksum
 
   }   Status
 Structure of data payload when answering status command.
 
buffer
 

Static Public Attributes

const unsigned static char HEADER_LENGTH = 7
 

Private Member Functions

 Q_DECLARE_TR_FUNCTIONS (FRONIUS_response)
 
unsigned char checksum ()
 

Detailed Description

Response from fronius invertor.

Definition at line 19 of file fronius_response.h.

Member Function Documentation

bool FRONIUS_response::isChecksumValid ( )

Check header validity.

Returns
true when the header is valid

Definition at line 43 of file fronius_response.cpp.

43  {
44  unsigned char chsum = \
45  length + \
46  device_option + \
47  device_number + \
48  command;
49  for (int i=0; i<length; i++) {
50  chsum += buffer.buffer[i];
51  }
52  return (chsum == checksum());
53 
54 }
unsigned char checksum
Returns checksum of the response.
bool FRONIUS_response::isHeaderValid ( )

Check header validity.

Returns
true when the header is valid

Definition at line 26 of file fronius_response.cpp.

26  {
27  return (hdr0==0x80 && hdr1==0x80 && hdr2==0x80);
28 }

The documentation for this class was generated from the following files: