hoymilesClient/inc/hoymiles/dtu.h

47 lines
835 B
C
Raw Normal View History

2024-03-16 21:15:15 +01:00
#ifndef DTU_H
#define DTU_H
#include <vector>
#include <memory>
2024-03-20 11:28:43 +01:00
#include <string>
// #include <mutex>
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
2024-03-19 16:59:41 +01:00
// struct _modbus;
// typedef _modbus modbus_t;
2024-03-16 21:15:15 +01:00
class Dtu {
private:
2024-03-19 16:59:41 +01:00
// std::shared_ptr<modbus_t*> modbus_context;
2024-03-20 10:26:02 +01:00
std::shared_ptr<class modbus> modbus;
2024-03-19 16:59:41 +01:00
// std::mutex modbus_context_mutex;
2024-03-16 21:15:15 +01:00
std::vector<Microinverter> microinverters;
bool connected;
2024-03-16 21:15:15 +01:00
void populateMicroinverters();
std::pair<bool, Microinverter*> getMicroinverterBySerialNumber(long serialNumber);
2024-03-16 21:15:15 +01:00
public:
Dtu(const char *ip_address, int port);
bool isConnected();
2024-03-16 21:15:15 +01:00
void updateMicroinverters();
2024-03-20 11:28:43 +01:00
void updateMicroinverters(std::vector<std::string> &parametersToGet);
void printMicroinverters();
2024-03-20 11:28:43 +01:00
void printMicroinverters(std::vector<std::string> &parametersToGet);
2024-03-16 21:15:15 +01:00
~Dtu();
};
#endif