2024-03-16 21:15:15 +01:00
|
|
|
#ifndef PORT_H
|
|
|
|
|
#define PORT_H
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <memory>
|
2024-03-17 21:33:21 +01:00
|
|
|
#include <mutex>
|
2024-03-16 21:15:15 +01:00
|
|
|
|
2024-03-16 22:51:32 +01:00
|
|
|
#include "portParametersGeneric.h"
|
|
|
|
|
|
2024-03-16 21:15:15 +01:00
|
|
|
struct _modbus;
|
|
|
|
|
typedef _modbus modbus_t;
|
|
|
|
|
|
|
|
|
|
class Port {
|
|
|
|
|
private:
|
2024-03-17 21:33:21 +01:00
|
|
|
std::shared_ptr<modbus_t*> modbus_context;
|
|
|
|
|
std::mutex *modbus_context_mutex;
|
|
|
|
|
|
2024-03-16 21:15:15 +01:00
|
|
|
uint16_t portStartAddress;
|
|
|
|
|
|
2024-03-18 00:54:10 +01:00
|
|
|
uint16_t *readArray;
|
|
|
|
|
int readArraySize;
|
|
|
|
|
|
2024-03-16 21:15:15 +01:00
|
|
|
std::vector<std::shared_ptr<PortParameter>> parameters;
|
|
|
|
|
|
|
|
|
|
void populateParameters();
|
|
|
|
|
|
|
|
|
|
public:
|
2024-03-17 21:33:21 +01:00
|
|
|
Port(std::shared_ptr<modbus_t*> modbus_context, std::mutex *modbus_context_mutex, uint16_t portStartAddress);
|
2024-03-16 21:15:15 +01:00
|
|
|
|
|
|
|
|
void updateParameters();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|