modbuspp  1.1.40
C++ wrapper for the libmodbus library
Modbus Namespace Reference

libmodbuspp namespace More...

Classes

class  BufferedSlave
 Buffered Slave. More...
 
class  Data
 Arithmetic data in multiple 16-bit Modbus registers. More...
 
class  DataType
 
class  Device
 Device connected to Modbus. More...
 
class  Master
 Master connected to Modbus (Client) More...
 
class  Message
 Modbus Message. More...
 
class  NetLayer
 Network layer base class (backend) More...
 
class  Request
 Modbus Request Message. More...
 
class  Response
 Modbus Response Message. More...
 
class  Router
 Router connected to Modbus. More...
 
class  RtuLayer
 RTU serial link layer. More...
 
class  Server
 Server connected to Modbus (Server) More...
 
class  Slave
 Slave connected to Modbus. More...
 
class  SlaveReport
 For storing and manipulate server identifier datas returns by the MODBUS 17 function. More...
 
class  TcpLayer
 TCP/IP v4 & v6 network layer. More...
 
class  Timeout
 Represents a timeout. More...
 

Enumerations

enum  DataEnum
 Enumerations of Data T.
 
enum  Endian {
  EndianBigBig = 0x00, EndianBig = EndianBigBig, EndianBigLittle = 0x01, EndianLittleBig = 0x02,
  EndianLittleLittle = 0x03, EndianLittle = EndianLittleLittle
}
 Sequential order in which bytes are arranged. More...
 
enum  ExceptionCode
 Enumerations of MODBUS exception code managed by libmodbuspp.
 
enum  Function
 Enumerations of MODBUS functions managed by libmodbuspp.
 
enum  Net { Rtu, Tcp, NoNet = Unknown }
 Enumeration of network layers (backends) used by Modbus. More...
 
enum  SerialMode { Rs232 = MODBUS_RTU_RS232, Rs485 = MODBUS_RTU_RS485, UnknownMode = Unknown }
 Enumeration of RTU serial link modes. More...
 
enum  SerialRts { RtsNone = MODBUS_RTU_RTS_NONE, RtsUp = MODBUS_RTU_RTS_UP, RtsDown = MODBUS_RTU_RTS_DOWN, UnknownRts = Unknown }
 RTS mode in RTU. More...
 
enum  Table
 Enumerations of data types managed by MODBUS.
 

Functions

template<typename T >
void strToT (T &v, const std::string &str, int base=0)
 Convert string to T. More...
 

Variables

const int Broadcast = MODBUS_BROADCAST_ADDRESS
 Modbus Broadcast Address.
 
const uint16_t MaxPduLength = MODBUS_MAX_PDU_LENGTH
 maximum size of a PDU
 
const int TcpSlave = MODBUS_TCP_SLAVE
 Can be used in TCP mode to restore the default value.
 
const int Unknown = -1
 Value corresponding to an unknown parameter.
 

Detailed Description

libmodbuspp namespace

Enumeration Type Documentation

◆ Endian

Sequential order in which bytes are arranged.

Enumerator
EndianBigBig 

Bytes in big endian order, word in big endian order : ABCD.

EndianBig 

Big endian order : ABCD.

EndianBigLittle 

Bytes in big endian order, word in little endian order : CDAB.

EndianLittleBig 

Bytes in little endian order, word in big endian order : BADC.

EndianLittleLittle 

Bytes in little endian order, word in little endian order : DCBA.

EndianLittle 

Little endian order : DCBA.

◆ Net

Enumeration of network layers (backends) used by Modbus.

Enumerator
Rtu 

RTU backend.

The RTU backend (Remote Terminal Unit) is used in serial communication and makes use of a compact, binary representation of the data for protocol communication.

Tcp 

TCP backend.

The TCP PI (Protocol Independent) backend implements a Modbus variant used for communications over TCP IPv4 and IPv6 networks.

NoNet 

Unknown network backend.

◆ SerialMode

Enumeration of RTU serial link modes.

Enumerator
Rs232 

RS232.

RS-232 (Recommended Standard 232) is the traditional name for a series of standards for serial binary single-ended data and control signals connecting between a DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating Equipment). It is commonly used in computer serial ports

Rs485 

RS485.

EIA-485, also known as TIA/EIA-485 or RS-485, is a standard defining the electrical characteristics of drivers and receivers for use in balanced digital multipoint systems. This standard is widely used for communications in industrial automation because it can be used effectively over long distances and in electrically noisy environments.

UnknownMode 

Unknown serial mode.

◆ SerialRts

RTS mode in RTU.

Request To Send mode to communicate on a RS485 serial bus.

By default, the mode is set to RtsNone and no signal is issued before writing data on the wire.

To enable the RTS mode, the values RtsUp or RtsDown must be used, these modes enable the RTS mode and set the polarity at the same time.

When RtsUp is used, an ioctl call is made with RTS flag enabled then data is written on the bus after a delay of 1 ms, then another ioctl call is made with the RTS flag disabled and again a delay of 1 ms occurs.

The RtsDown mode applies the same procedure but with an inverted RTS flag.

Enumerator
RtsNone 

no use of the RTS.

RtsUp 

RTS flag ON during communication, OFF outside.

RtsDown 

RTS flag OFF during communication, ON outside.

UnknownRts 

Unknown RTS mode.

Function Documentation

◆ strToT()

template<typename T >
void Modbus::strToT ( T &  v,
const std::string &  str,
int  base = 0 
)

Convert string to T.

Parses str interpreting its content as a T number, which is returned as a value of type T. T may be uint16_t, uint32_t, uint64_t, int16_t, int32_t, int64_t, float, double, long double