QModbusRtuSerialClient Class
QModbusRtuSerialClient 类表示一个 Modbus 客户端,该客户端使用串行总线与 Modbus 服务器进行通信。更多内容...
| 头文件: | #include <QModbusRtuSerialClient> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS SerialBus) target_link_libraries(mytarget PRIVATE Qt6::SerialBus) |
| qmake: | QT += serialbus |
| 自: | Qt 6.2 |
| 继承自: | QModbusClient |
公共函数
| QModbusRtuSerialClient(QObject *parent = nullptr) | |
| int | interFrameDelay() const |
| void | setInterFrameDelay(int microseconds) |
| void | setTurnaroundDelay(int turnaroundDelay) |
| int | turnaroundDelay() const |
重新实现的受保护函数
成员函数文档
[explicit] QModbusRtuSerialClient::QModbusRtuSerialClient(QObject *parent = nullptr)
使用指定的parent 构建一个串行Modbus客户端。
[override virtual protected] void QModbusRtuSerialClient::close()
重写了:QModbusDevice::close()。
int QModbusRtuSerialClient::interFrameDelay() const
返回两个连续 Modbus 消息之间静默间隔的微秒数。
另请参阅 setInterFrameDelay()。
[override virtual protected] bool QModbusRtuSerialClient::open()
重写了:QModbusDevice::open()。
注意: 调用此函数时, 串口中的现有缓冲数据将被清除。
void QModbusRtuSerialClient::setInterFrameDelay(int microseconds)
设置两个连续 Modbus 消息之间静默间隔的microseconds 值。默认情况下,类实现将根据 Modbus 规范使用预先计算的值。已建立或正在运行的连接不会受到此类延迟变化的影响。
注意:如果将 microseconds 设置为-1,或者microseconds 小于预先计算的延迟值,则将使用该预先计算的值作为帧延迟。
另请参阅 interFrameDelay()。
void QModbusRtuSerialClient::setTurnaroundDelay(int turnaroundDelay)
将Modbus广播与后续Modbus消息之间的静默间隔时间(以毫秒为单位)设置为turnaroundDelay 。通常,该间隔时间在100 至200 毫秒之间。
另请参阅 turnaroundDelay()。
int QModbusRtuSerialClient::turnaroundDelay() const
返回 Modbus 广播与后续 Modbus 消息之间静默间隔的毫秒数。默认值设置为100 毫秒。
另请参阅 setTurnaroundDelay()。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.