- Qt 5.15
- Qt Serial Bus
- C++ Classes
- QModbusExceptionResponse
- Qt 5.15.15 Reference Documentation

# QModbusExceptionResponse Class

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

Header: | #include <QModbusExceptionResponse>
qmake: | QT += serialbus
Since: | Qt 5.8
Inherits: | QModbusResponse

This class was introduced in Qt 5.8.

- List of all members, including inherited members

## Public Functions

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

## Reimplemented Public Functions

virtual void | setFunctionCode(FunctionCode c) override

## Detailed Description

A typical QModbusExceptionResponse response can looks like this:

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

## Member Function Documentation

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

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

### QModbusExceptionResponse::QModbusExceptionResponse(const QModbusPdu &pdu)

Constructs a copy of pdu.

### QModbusExceptionResponse::QModbusExceptionResponse()

Constructs an invalid QModbusExceptionResponse.

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

Sets the response's exception code to ec.

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

Sets the response's function code to c.