Public Member Functions | List of all members
prbt_hardware_support::ModbusClient Class Referenceabstract

#include <modbus_client.h>

Inheritance diagram for prbt_hardware_support::ModbusClient:
Inheritance graph
[legend]

Public Member Functions

virtual unsigned long getResponseTimeoutInMs ()=0
 Get the response timeout. More...
 
virtual bool init (const char *ip, unsigned int port)=0
 Initialize the modbus client by connecting to the server. More...
 
virtual RegCont readHoldingRegister (int addr, int nb)=0
 Read the holding registers. More...
 
virtual void setResponseTimeoutInMs (unsigned long timeout_ms)=0
 Set the response timeout. More...
 
virtual RegCont writeReadHoldingRegister (const int write_addr, const RegCont &write_reg, const int read_addr, const int read_nb)=0
 
virtual ~ModbusClient ()=default
 

Detailed Description

Definition at line 28 of file modbus_client.h.

Constructor & Destructor Documentation

◆ ~ModbusClient()

virtual prbt_hardware_support::ModbusClient::~ModbusClient ( )
virtualdefault

Member Function Documentation

◆ getResponseTimeoutInMs()

virtual unsigned long prbt_hardware_support::ModbusClient::getResponseTimeoutInMs ( )
pure virtual

Get the response timeout.

Returns
response timeout

Implemented in prbt_hardware_support::LibModbusClient.

◆ init()

virtual bool prbt_hardware_support::ModbusClient::init ( const char *  ip,
unsigned int  port 
)
pure virtual

Initialize the modbus client by connecting to the server.

Parameters
ipof the server
portto use
Returns
true if the connection to the server succeeded
false if the connection to the server failed

Implemented in prbt_hardware_support::LibModbusClient.

◆ readHoldingRegister()

virtual RegCont prbt_hardware_support::ModbusClient::readHoldingRegister ( int  addr,
int  nb 
)
pure virtual

Read the holding registers.

Parameters
addrstarting address to read from
nbnumber of registers to read
Exceptions
ModbusExceptionDisconnectif a disconnect from the server happens
Returns
the registers content.

Implemented in prbt_hardware_support::LibModbusClient.

◆ setResponseTimeoutInMs()

virtual void prbt_hardware_support::ModbusClient::setResponseTimeoutInMs ( unsigned long  timeout_ms)
pure virtual

Set the response timeout.

Interval to wait for a response from the server if within this timespan no answer is received readHoldingRegisters will throw a ModbusExceptionDisconnect

Parameters
timeout_msin ms

Implemented in prbt_hardware_support::LibModbusClient.

◆ writeReadHoldingRegister()

virtual RegCont prbt_hardware_support::ModbusClient::writeReadHoldingRegister ( const int  write_addr,
const RegCont write_reg,
const int  read_addr,
const int  read_nb 
)
pure virtual

The documentation for this class was generated from the following file:


prbt_hardware_support
Author(s):
autogenerated on Sat Jul 4 2020 03:11:51