QModbusExceptionResponse Class

QModbusExceptionResponse 是一个容器类,其中包含 Modbus ADU 内部的功能和错误代码。更多

头文件: #include <QModbusExceptionResponse>
CMake: find_package(Qt6 REQUIRED COMPONENTS SerialBus)
target_link_libraries(mytarget PRIVATE Qt6::SerialBus)
qmake: QT += serialbus
继承: QModbusResponse

公共函数

QModbusExceptionResponse()
QModbusExceptionResponse(const QModbusPdu &pdu)
QModbusExceptionResponse(QModbusPdu::FunctionCode code, QModbusPdu::ExceptionCode ec)
void setExceptionCode(QModbusPdu::ExceptionCode ec)

重新实现的公共函数

virtual void setFunctionCode(QModbusPdu::FunctionCode c) override

详细说明

典型的 QModbusExceptionResponse 响应如下:

QModbusExceptionResponse exception(QModbusExceptionResponse::ReportServerId,
    QModbusExceptionResponse::ServerDeviceFailure);

成员函数文档

[constexpr noexcept] QModbusExceptionResponse::QModbusExceptionResponse()

构造一个无效的 QModbusExceptionResponse。

QModbusExceptionResponse::QModbusExceptionResponse(const QModbusPdu &pdu)

构造pdu 的副本。

QModbusExceptionResponse::QModbusExceptionResponse(QModbusPdu::FunctionCode code, QModbusPdu::ExceptionCode ec)

构造一个 QModbusExceptionResponse,其功能代码设为code ,异常错误代码设为ec

void QModbusExceptionResponse::setExceptionCode(QModbusPdu::ExceptionCode ec)

将响应的异常代码设为ec

[override virtual] void QModbusExceptionResponse::setFunctionCode(QModbusPdu::FunctionCode c)

重新实现:QModbusPdu::setFunctionCode(QModbusPdu::FunctionCode code)。

将响应的功能代码设为c

© 2025 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.