hoymilesClient/inc/hoymiles/port.h

49 lines
1.1 KiB
C
Raw Normal View History

2024-03-16 21:15:15 +01:00
#ifndef PORT_H
#define PORT_H
#include <stdint.h>
#include <string>
#include <vector>
#include "portParametersGeneric.h"
2024-04-06 00:32:49 +02:00
#include "portParameters.h"
2024-03-19 16:59:41 +01:00
#include "modbus.h"
2024-03-16 21:15:15 +01:00
class Port {
private:
void populateParameters();
2024-03-19 09:22:21 +01:00
void fixCurrent();
bool currentFixed;
// void increaseParametersAge();
2024-03-16 21:15:15 +01:00
public:
Port(int portStartAddress);
2024-03-16 21:15:15 +01:00
2024-03-28 11:05:07 +01:00
int portStartAddress;
2024-04-06 00:32:49 +02:00
int statusPortStartAddress;
std::vector<std::shared_ptr<PortParameter>> parameters;
2024-04-06 00:32:49 +02:00
std::vector<std::shared_ptr<PortParameter>> statusParameters;
2024-03-20 19:55:36 +01:00
std::pair<std::shared_ptr<PortParameter>, bool> getParameterByName(std::string name);
2024-04-06 00:32:49 +02:00
std::pair<std::shared_ptr<PortParameter>, bool> getStatusByName(std::string name);
// void updateParameters(std::vector<std::string> &parametersToGet, bool allParameters);
void setParametersFromMicroinverterArray(uint16_t *registers, int addressOffset);
2024-03-20 11:28:43 +01:00
2024-04-06 00:32:49 +02:00
void setStatusesFromMicroinverterArray(uint16_t *registers, int addressOffset);
2024-03-20 20:17:15 +01:00
void printParameters(std::vector<std::string> &parametersToGet, bool allParameters, bool shortNames);
2024-04-06 00:32:49 +02:00
2024-04-09 12:21:21 +02:00
void turnOff(modbus_t *modbus);
2024-04-06 00:32:49 +02:00
2024-04-09 12:21:21 +02:00
bool isOff(modbus_t *modbus);
2024-03-16 21:15:15 +01:00
};
#endif