QModbusRtuSerialSlave Class

The QModbusRtuSerialSlave class represents a Modbus server that uses a serial port for its communication with the Modbus client. 更多...

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

该类在 Qt 5.8 引入。

公共函数

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

重实现公共函数

virtual bool processesBroadcast () const override

重实现保护函数

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

详细描述

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

Since multiple Modbus server instances can interact with a Modbus client at the same time (using a serial bus), servers are identified by their serverAddress ().

成员函数文档编制

QModbusRtuSerialSlave:: QModbusRtuSerialSlave ( QObject * parent = nullptr)

Constructs a QModbusRtuSerialSlave with the specified parent serverAddress preset is 1 .

[虚拟] QModbusRtuSerialSlave:: ~QModbusRtuSerialSlave ()

销毁 QModbusRtuSerialSlave 实例。

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

重实现: QModbusDevice::close ().

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

重实现: QModbusDevice::open ().

注意: When calling this function, existing buffered data is removed from the serial port.

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

重实现: QModbusServer::processRequest (const QModbusPdu &request).

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

The Modbus function QModbusRequest::EncapsulatedInterfaceTransport with MEI Type 13 (0x0D) CANopen General Reference is filtered out because it is usually Modbus TCP or Modbus serial ASCII only.

A request to the RTU serial slave will be answered with a Modbus exception response with the exception code QModbusExceptionResponse::IllegalFunction .

[override virtual] bool QModbusRtuSerialSlave:: processesBroadcast () const

重实现: QModbusServer::processesBroadcast () const.