Initial release commit
This commit is contained in:
commit
0e25af7ef8
15 changed files with 12511 additions and 0 deletions
87
inc/hoymiles/portParameters/portParameters.h
Normal file
87
inc/hoymiles/portParameters/portParameters.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
#ifndef PORTPARAMETERS_H
|
||||
#define PORTPARAMETERS_H
|
||||
|
||||
#include "portParametersGeneric.h"
|
||||
|
||||
class PortParameterMicroinverterSerialNumber : public PortParameterInt {
|
||||
protected:
|
||||
void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
|
||||
public:
|
||||
PortParameterMicroinverterSerialNumber();
|
||||
};
|
||||
|
||||
class PortParameterPortNumber : public PortParameterInt {
|
||||
private:
|
||||
void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
|
||||
public:
|
||||
PortParameterPortNumber();
|
||||
};
|
||||
|
||||
class PortParameterPvVoltage : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterPvVoltage();
|
||||
};
|
||||
|
||||
class PortParameterPvCurrentMi : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterPvCurrentMi();
|
||||
};
|
||||
|
||||
class PortParameterPvCurrentHm : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterPvCurrentHm();
|
||||
};
|
||||
|
||||
class PortParameterGridVoltage : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterGridVoltage();
|
||||
};
|
||||
|
||||
class PortParameterGridFrequency : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterGridFrequency();
|
||||
};
|
||||
|
||||
class PortParameterPvPower : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterPvPower();
|
||||
};
|
||||
|
||||
class PortParameterTodayProduction : public PortParameterInt {
|
||||
public:
|
||||
PortParameterTodayProduction();
|
||||
};
|
||||
|
||||
class PortParameterTotalProduction : public PortParameterInt {
|
||||
public:
|
||||
PortParameterTotalProduction();
|
||||
};
|
||||
|
||||
class PortParameterTemperature : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterTemperature();
|
||||
};
|
||||
|
||||
class PortParameterOperatingStatus : public PortParameterInt {
|
||||
public:
|
||||
PortParameterOperatingStatus();
|
||||
};
|
||||
|
||||
class PortParameterAlarmCode : public PortParameterInt {
|
||||
public:
|
||||
PortParameterAlarmCode();
|
||||
};
|
||||
|
||||
class PortParameterAlarmCount : public PortParameterInt {
|
||||
public:
|
||||
PortParameterAlarmCount();
|
||||
};
|
||||
|
||||
class PortParameterLinkStatus : public PortParameterInt {
|
||||
public:
|
||||
PortParameterLinkStatus();
|
||||
};
|
||||
|
||||
#endif
|
||||
68
inc/hoymiles/portParameters/portParametersGeneric.h
Normal file
68
inc/hoymiles/portParameters/portParametersGeneric.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#ifndef PORTPARAMETERSGENERIC_H
|
||||
#define PORTPARAMETERSGENERIC_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
// #include <mutex>
|
||||
|
||||
struct _modbus;
|
||||
typedef _modbus modbus_t;
|
||||
|
||||
class PortParameter {
|
||||
protected:
|
||||
uint16_t parameterAddressOffset;
|
||||
int registerSize;
|
||||
|
||||
virtual void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
|
||||
public:
|
||||
PortParameter(std::string name, uint16_t parameterAddressOffset, int registerSize);
|
||||
|
||||
virtual ~PortParameter();
|
||||
|
||||
enum PortParameterValueType { Int, Float };
|
||||
|
||||
union PortParameterValue {
|
||||
long long i;
|
||||
float f;
|
||||
};
|
||||
|
||||
protected:
|
||||
PortParameterValueType valueType;
|
||||
PortParameterValue value;
|
||||
|
||||
public:
|
||||
std::string name;
|
||||
int age;
|
||||
|
||||
std::pair<PortParameterValue, PortParameterValueType> getValue();
|
||||
|
||||
virtual std::string getOutputValue();
|
||||
|
||||
void updateValue(std::shared_ptr<class modbus> modubs, uint16_t portStartAddress);
|
||||
};
|
||||
|
||||
class PortParameterFloat : public PortParameter {
|
||||
protected:
|
||||
int decimalPlaces;
|
||||
|
||||
virtual void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
|
||||
public:
|
||||
PortParameterFloat(std::string name, int decimalPlaces, uint16_t parameterAddressOffset, int registerSize);
|
||||
|
||||
std::string getOutputValue();
|
||||
};
|
||||
|
||||
class PortParameterInt : public PortParameter {
|
||||
protected:
|
||||
virtual void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
|
||||
public:
|
||||
PortParameterInt(std::string name, uint16_t parameterAddressOffset, int registerSize);
|
||||
|
||||
std::string getOutputValue();
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue