modbuspp
1.1.40
C++ wrapper for the libmodbus library
|
TCP/IP v4 & v6 network layer. More...
#include <tcplayer.h>
Public Member Functions | |
const std::string & | connection () const |
Returns the connection used. More... | |
modbus_t * | context () |
libmodbus context More... | |
const modbus_t * | context () const |
uint16_t | maxAduLength () const |
Returns the maximum ADU length. | |
Net | net () const |
Underlying layer used (backend) More... | |
const std::string & | node () const |
Host name or IP address. More... | |
virtual bool | prepareToSend (Message &msg) |
virtual int | sendRawMessage (const Message *msg) |
const std::string & | service () const |
Service name or port number. More... | |
const std::string & | settings () const |
Returns the connection settings. More... | |
TcpLayer (const std::string &host, const std::string &service) | |
Constructor. | |
Static Public Member Functions | |
static bool | checkMessage (const Message &msg) |
static std::string | lastError () |
last error message More... | |
TCP/IP v4 & v6 network layer.
This class can not and should not be instantiated by the user. It provides access to properties and methods specific to the TCP layer.
An instance of this class is created by the constructor Device::Device() of the Device class (or its derived classes) if the TCP layer is selected.
Access to this instance is done using the Device::tcp() method.
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inherited |
Returns the connection used.
Serial port or host depending on the backend.
|
inherited |
libmodbus context
context is an opaque structure containing all necessary information to establish a connection with other Modbus devices according to the selected variant.
|
inherited |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
staticinherited |
last error message
This function shall return the error message corresponding to the last error. This function must be called right after the instruction that triggered an error.
|
inherited |
Underlying layer used (backend)
This function allows to know the underlying layer used.
const std::string& Modbus::TcpLayer::node | ( | ) | const |
Host name or IP address.
This property specifies the host name or IP address of the host to which we are connected, eg. "192.168.0.5" , "::1" or "server.com".
|
virtual |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Reimplemented from Modbus::NetLayer.
|
virtual |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Reimplemented from Modbus::NetLayer.
const std::string& Modbus::TcpLayer::service | ( | ) | const |
Service name or port number.
This property is the service name/port number to which we are connected.
|
inherited |
Returns the connection settings.
IP port or speed, parity and stop bit depending on the backend