W3cubDocs

/Qt

QModbusRtuSerialClient Class

The QModbusRtuSerialClient class represents a Modbus client that uses a serial bus for its communication with the Modbus server. More...

Header: #include <QModbusRtuSerialClient>
qmake: QT += serialbus
Since: Qt 6.2
Inherits: QModbusClient

Public Functions

QModbusRtuSerialClient(QObject *parent = nullptr)
int interFrameDelay() const
void setInterFrameDelay(int microseconds)
void setTurnaroundDelay(int turnaroundDelay)
int turnaroundDelay() const

Reimplemented Protected Functions

virtual void close() override
virtual bool open() override

Detailed Description

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

Member Function Documentation

QModbusRtuSerialClient::QModbusRtuSerialClient(QObject *parent = nullptr)

Constructs a serial Modbus client with the specified parent.

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

Reimplements: QModbusDevice::close().

int QModbusRtuSerialClient::interFrameDelay() const

Returns the amount of microseconds for the silent interval between two consecutive Modbus messages.

See also setInterFrameDelay().

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

Reimplements: QModbusDevice::open().

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

void QModbusRtuSerialClient::setInterFrameDelay(int microseconds)

Sets the amount of microseconds for the silent interval between two consecutive Modbus messages. By default, the class implementation will use a pre-calculated value according to the Modbus specification. A active or running connection is not affected by such delay changes.

Note: If microseconds is set to -1 or microseconds is less than the pre-calculated delay then this pre-calculated value is used as frame delay.

See also interFrameDelay().

[since 5.13] void QModbusRtuSerialClient::setTurnaroundDelay(int turnaroundDelay)

Sets the amount of milliseconds for the silent interval between a Modbus broadcast and a consecutive Modbus messages to turnaroundDelay. Typically the turnaround delay is in the range of 100 to 200 milliseconds.

This function was introduced in Qt 5.13.

See also turnaroundDelay().

[since 5.13] int QModbusRtuSerialClient::turnaroundDelay() const

Returns the amount of milliseconds for the silent interval between a Modbus broadcast and a consecutive Modbus messages. The default value is set to 100 milliseconds.

This function was introduced in Qt 5.13.

See also setTurnaroundDelay().

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qmodbusrtuserialclient.html