QModbusDataUnit Class

QModbusDataUnit is a container class representing single bit and 16 bit word entries in the Modbus register. More...

Header: #include <QModbusDataUnit>
qmake: QT += serialbus
Since: Qt 5.8

This class was introduced in Qt 5.8.

Public Types

enum RegisterType { Invalid, DiscreteInputs, Coils, InputRegisters, HoldingRegisters }

Detailed Description

QModbusDataUnit can be used for read and write operations. The entries are addressed via startAddress() and the valueCount() number of contiguous entries. registerType() determines which register is used for the operations. Note that some registers are read-only registers.

The actual values() are either single bit or 16 bit based. QModbusDataUnit::DiscreteInputs and QModbusDataUnit::Coils only accept single bits. Therefore 0 is interpreted as 0 and anything else 1.

Member Type Documentation

enum QModbusDataUnit::RegisterType

This enum describes all supported register types.

ConstantValueDescription
QModbusDataUnit::Invalid0Set by the default constructor, do not use.
QModbusDataUnit::DiscreteInputs1This type of data can be provided by an I/O system.
QModbusDataUnit::Coils2This type of data can be alterable by an application program.
QModbusDataUnit::InputRegisters3This type of data can be provided by an I/O system.
QModbusDataUnit::HoldingRegisters4This type of data can be alterable by an application program.

Related Non-Members

typedef QModbusDataUnit::QModbusDataUnitMap

Synonym for QMap<QModbusDataUnit::RegisterType, QModbusDataUnit>.

This typedef was introduced in Qt 5.8.