QModbusExceptionResponse Class

QModbusExceptionResponse is a container class containing the function and error code inside a Modbus ADU. More...

Header: #include <QModbusExceptionResponse>
CMake: find_package(Qt6 REQUIRED COMPONENTS SerialBus)
target_link_libraries(mytarget PRIVATE Qt6::SerialBus)
qmake: QT += serialbus
Inherits: QModbusResponse

Public Functions

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

Reimplemented Public Functions

virtual void setFunctionCode(QModbusPdu::FunctionCode c) override

Detailed Description

A typical QModbusExceptionResponse response can looks like this:

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

Member Function Documentation

[constexpr noexcept] QModbusExceptionResponse::QModbusExceptionResponse()

Constructs an invalid QModbusExceptionResponse.

QModbusExceptionResponse::QModbusExceptionResponse(const QModbusPdu &pdu)

Constructs a copy of pdu.

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

Constructs a QModbusExceptionResponse with function code set to code and exception error code set to ec.

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

Sets the response's exception code to ec.

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

Reimplements: QModbusPdu::setFunctionCode(QModbusPdu::FunctionCode code).

Sets the response's function code to c.

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