QModbusTcpServer Class

The QModbusTcpServer class represents a Modbus server that uses a TCP server for its communication with the Modbus client. 更多...

头: #include <QModbusTcpServer>
qmake: QT += serialbus
Since: Qt 5.8
继承: QModbusServer

公共函数

QModbusTcpServer (QObject * parent = nullptr)
virtual ~QModbusTcpServer ()

静态公共成员

const QMetaObject staticMetaObject

重实现保护函数

virtual void close () override
virtual bool open () override
virtual QModbusResponse processRequest (const QModbusPdu & request ) override

额外继承成员

详细描述

The QModbusTcpServer class represents a Modbus server that uses a TCP server for its communication with the Modbus client.

Communication via Modbus requires the interaction between a single Modbus client instance and single Modbus server. This class provides the Modbus server implementation via a TCP server.

Modbus TCP networks can have multiple servers. Servers are read/written by a client device represented by QModbusTcpClient .

成员函数文档编制

QModbusTcpServer:: QModbusTcpServer ( QObject * parent = nullptr)

构造 QModbusTcpServer 采用指定 parent serverAddress preset is 255 .

[虚拟] QModbusTcpServer:: ~QModbusTcpServer ()

销毁 QModbusTcpServer 实例。

[override virtual protected] void QModbusTcpServer:: close ()

重实现自 QModbusDevice::close ().

[override virtual protected] bool QModbusTcpServer:: open ()

重实现自 QModbusDevice::open ().

[override virtual protected] QModbusResponse QModbusTcpServer:: processRequest (const QModbusPdu & request )

重实现自 QModbusServer::processRequest ().

Processes the Modbus client request specified by request and returns a Modbus response.

The following Modbus function codes are filtered out as they are serial line only according to the Modbus Application Protocol Specification 1.1b:

A request to the TCP server will be answered with a Modbus exception response with the exception code QModbusExceptionResponse::IllegalFunction .