QModbusResponse Class
QModbusResponse is a container class containing the function code and payload that is stored inside a Modbus ADU. More...
| Header: | #include <QModbusResponse> |
| qmake: | QT += serialbus |
| Since: | Qt 5.8 |
| Inherits: | QModbusPdu |
| Inherited By: |
This class was introduced in Qt 5.8.
Public Types
| (alias) | CalcFuncPtr |
Detailed Description
A typical Modbus response can looks like this:
QModbusResponse response(QModbusResponse::ReadCoils, QByteArray::fromHex("02cd01"));
Note: When using the constructor taking the QByteArray, please make sure to convert the containing data to big-endian byte order before creating the request.
The same response can be created like this, if the values are known at compile time:
quint8 payloadInBytes = 2, outputHigh = 0xcd, outputLow = 0x01; QModbusResponse response(QModbusResponse::ReadCoils, payloadInBytes, outputHigh, outputLow);