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 |
开始支持版本: | Qt 5.8 |
基类: | QModbusServer |
公有函数
QModbusTcpServer(QObject *parent = nullptr) | |
~QModbusTcpServer() |
- 10 个公有函数继承自 QModbusServer
- 7 个公有函数继承自 QModbusDevice
- 32 个公有函数继承自 QObject
重新实现的受保护函数
virtual void | close() override |
virtual bool | open() override |
virtual QModbusResponse | processRequest(const QModbusPdu &request) override |
- 4 个受保护的函数继承自 QModbusServer
- 4 个受保护的函数继承自 QModbusDevice
- 9 个受保护的函数继承自 QObject
其他继承的成员
- 1 个属性继承自 QObject
- 1 个公有槽函数继承自 QObject
- 1 个信号继承自 QModbusServer
- 2 个信号继承自 QModbusDevice
- 2 个信号继承自 QObject
- 1 个公有变量继承自 QObject
- 10 个静态公有成员继承自 QObject
- 4 个受保护的函数继承自 QModbusServer
- 4 个受保护的函数继承自 QModbusDevice
- 9 个受保护的函数继承自 QObject
- 2 个受保护的变量继承自 QObject
详细描述
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)
Constructs a QModbusTcpServer with the specified parent. The serverAddress preset is 255
.
QModbusTcpServer::~QModbusTcpServer()
Destroys the QModbusTcpServer instance.
[override virtual protected]
void QModbusTcpServer::close()
Reimplemented from QModbusDevice::close().
[override virtual protected]
bool QModbusTcpServer::open()
Reimplemented from QModbusDevice::open().
[override virtual protected]
QModbusResponse QModbusTcpServer::processRequest(const QModbusPdu &request)
Reimplemented from 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:
- QModbusRequest::ReadExceptionStatus
- QModbusRequest::Diagnostics
- QModbusRequest::GetCommEventCounter
- QModbusRequest::GetCommEventLog
- QModbusRequest::ReportServerId
A request to the TCP server will be answered with a Modbus exception response with the exception code QModbusExceptionResponse::IllegalFunction.