/**************************************************************************** * Copyright (c) 2022 Priva b.v. ****************************************************************************/ #pragma once // std #include #include #include using modbusData = std::vector>; // Forward Declaration class ConnectionConfig; /*! * \brief The IModbusAdapter class */ class IModbusAdapter { public: virtual ~IModbusAdapter() {} virtual void ModbusConnect( const ConnectionConfig &conncfg ) = 0; /*! * \brief ModbusDisconnect */ virtual void ModbusDisconnect() = 0; /*! * \brief ModbusReadData * \param slaveId * \param startAddress * \param noOfItems */ virtual modbusData ModbusReadData( int slaveId, int functionCode, int startAddress, int noOfItems ) = 0; /*! * \brief ModbusReadHoldReg * \param slaveId * \param startAddress * \param noOfItems * \return */ virtual modbusData ModbusReadHoldReg( int slaveId, int startAddress, int noOfItems ) = 0; /*! * \brief ModBusWriteData * \param slaveId * \param funtionCode * \param startAddress * \param noOfItems * \param values */ virtual void ModBusWriteData( int slaveId, int functionCode, int startAddress, int noOfItems, std::vectorvalues ) = 0; /*! * \brief isConnected * \return */ virtual bool isConnected() const = 0; /*! * \brief ErrorString * \param errnum * \return */ virtual std::string ErrorString( int errnum ) const = 0; };