QModbusRtuSerialSlave Class
The QModbusRtuSerialSlave class represents a Modbus server that uses a serial port for its communication with the Modbus client. More...
| Header: | #include <QModbusRtuSerialSlave> |
| qmake: | QT += serialbus |
| Since: | Qt 5.8 |
| Inherits: | QModbusServer |
This class was introduced in Qt 5.8.
Public Functions
| QModbusRtuSerialSlave(QObject *parent = nullptr) | |
| virtual | ~QModbusRtuSerialSlave() |
Reimplemented Public Functions
| virtual bool | processesBroadcast() const override |
- 10 public functions inherited from QModbusServer
- 7 public functions inherited from QModbusDevice
- 30 public functions inherited from QObject
Reimplemented Protected Functions
| virtual void | close() override |
| virtual bool | open() override |
| virtual QModbusResponse | processRequest(const QModbusPdu &request) override |
- 4 protected functions inherited from QModbusServer
- 4 protected functions inherited from QModbusDevice
- 9 protected functions inherited from QObject
Related Non-Members
| typedef | QObjectList |
| QList<T> | qFindChildren(const QObject *obj, const QRegExp ®Exp) |
| T | qobject_cast(QObject *object) |
| T | qobject_cast(const QObject *object) |
Macros
| QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
| Q_CLASSINFO(Name, Value) | |
| Q_DISABLE_COPY(Class) | |
| Q_DISABLE_COPY_MOVE(Class) | |
| Q_DISABLE_MOVE(Class) | |
| Q_EMIT | |
| Q_ENUM(...) | |
| Q_ENUM_NS(...) | |
| Q_FLAG(...) | |
| Q_FLAG_NS(...) | |
| Q_GADGET | |
| Q_INTERFACES(...) | |
| Q_INVOKABLE | |
| Q_NAMESPACE | |
| Q_OBJECT | |
| Q_PROPERTY(...) | |
| Q_REVISION | |
| Q_SET_OBJECT_NAME(Object) | |
| Q_SIGNAL | |
| Q_SIGNALS | |
| Q_SLOT | |
| Q_SLOTS |
Additional Inherited Members
- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 1 signal inherited from QModbusServer
- 2 signals inherited from QModbusDevice
- 2 signals inherited from QObject
- 9 static public members inherited from QObject
- 4 protected functions inherited from QModbusServer
- 4 protected functions inherited from QModbusDevice
- 9 protected functions inherited from QObject
Detailed Description
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().
Member Function Documentation
QModbusRtuSerialSlave::QModbusRtuSerialSlave(QObject *parent = nullptr)
Constructs a QModbusRtuSerialSlave with the specified parent. The serverAddress preset is 1.
[virtual] QModbusRtuSerialSlave::~QModbusRtuSerialSlave()
Destroys the QModbusRtuSerialSlave instance.
[override virtual protected] void QModbusRtuSerialSlave::close()
Reimplements: QModbusDevice::close().
[override virtual protected] bool QModbusRtuSerialSlave::open()
Reimplements: QModbusDevice::open().
Note: When calling this function, existing buffered data is removed from the serial port.
[override virtual protected] QModbusResponse QModbusRtuSerialSlave::processRequest(const QModbusPdu &request)
Reimplements: 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
Reimplements: QModbusServer::processesBroadcast() const.