QModbusServer Class

The QModbusServer class is the interface to receive and process Modbus requests. More...

Header: #include <QModbusServer>
qmake: QT += serialbus
Since: Qt 5.8
Inherits: QModbusDevice
Inherited By:

QModbusRtuSerialSlave and QModbusTcpServer

This class was introduced in Qt 5.8.

Public Types

enum Option { DiagnosticRegister, ExceptionStatusOffset, DeviceBusy, AsciiInputDelimiter, ListenOnlyMode, …, UserOption }

Detailed Description

Modbus networks can have multiple Modbus servers. Modbus Servers are read/written by a Modbus client represented by QModbusClient. QModbusServer communicates with a Modbus backend, providing users with a convenient API.

Member Type Documentation

enum QModbusServer::Option

Each Modbus server has a set of values associated with it, each with its own option.

The general purpose options (and the associated types) are:

ConstantValueDescription
QModbusServer::DiagnosticRegister0The diagnostic register of the server. quint16
QModbusServer::ExceptionStatusOffset1The exception status byte offset of the server. quint16
QModbusServer::DeviceBusy2Flag to signal the server is engaged in processing a long-duration program command. quint16
QModbusServer::AsciiInputDelimiter3The Modbus ASCII end of message delimiter. char
QModbusServer::ListenOnlyMode4Flag to set listen only mode of the server. This function is typically supported only by Modbus serial devices. bool
QModbusServer::ServerIdentifier5The identifier of the server, not the server address. quint8
QModbusServer::RunIndicatorStatus6The run indicator of the server. quint8
QModbusServer::AdditionalData7The additional data of the server. QByteArray
QModbusServer::DeviceIdentification8The physical and functional description of the server. QModbusDeviceIdentification

User options:

ConstantValueDescription
QModbusServer::UserOption0x100The first option that can be used for user-specific purposes.

For user options, it is up to the developer to decide which types to use and ensure that components use the correct types when accessing and setting values.