hoymilesClient/inc/hoymiles/dtu.h

56 lines
1.2 KiB
C
Raw Permalink Normal View History

2024-03-16 21:15:15 +01:00
#ifndef DTU_H
#define DTU_H
#include <memory>
2024-03-20 11:28:43 +01:00
#include <string>
#include <vector>
2024-03-16 21:15:15 +01:00
#include "microinverter.h"
2024-03-19 16:59:41 +01:00
#include "modbus.h"
2024-03-16 21:15:15 +01:00
class Dtu {
private:
2024-04-09 12:21:21 +02:00
modbus_t *modbus;
2024-03-19 16:59:41 +01:00
2024-03-16 21:15:15 +01:00
std::vector<Microinverter> microinverters;
2024-04-18 18:27:31 +02:00
Port dtuPort;
int rtuId;
2024-04-09 12:21:21 +02:00
bool connected;
2024-03-16 21:15:15 +01:00
void populateMicroinverters();
public:
2024-04-09 12:21:21 +02:00
Dtu(const char *address, int id, bool rtu, bool tcp);
2024-03-16 21:15:15 +01:00
2024-04-18 18:27:31 +02:00
Dtu(modbus_t *modbus, int id);
2024-04-06 00:32:49 +02:00
std::pair<Microinverter *, bool> getMicroinverterBySerialNumber(long long serialNumber);
bool isConnected();
2024-03-20 16:39:25 +01:00
void updateMicroinverters(std::vector<std::string> &parametersToGet, bool allParameters, std::vector<long long> &microinvertersToGet);
2024-03-20 11:28:43 +01:00
void printMicroinverters(std::vector<std::string> &parametersToGet, bool allParameters, std::vector<long long> &microinvertersToGet, bool shortNames, bool printTodayProduction, bool printTotalProduction);
2024-03-20 11:28:43 +01:00
2024-04-06 16:29:02 +02:00
void setStatusMicroinverters(uint16_t value, std::string statusName, std::vector<long long>& microinvertersToSet);
2024-04-06 19:29:23 +02:00
bool empty();
2024-04-09 12:21:21 +02:00
void listOfMicroinverters();
2024-04-18 18:27:31 +02:00
float getCurrentPower();
int getCurrentOnOff();
void turnOffMicroinverters();
void turnOnMicroinverters();
void limitMicroinverters(uint16_t limit);
2024-03-16 21:15:15 +01:00
~Dtu();
};
#endif