QModbusDeviceIdentification Class

The QModbusDeviceIdentification is a container class representing the physical and functional description of a Modbus server. More...

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

This class was introduced in Qt 5.8.

Public Types

enum ConformityLevel { BasicConformityLevel, RegularConformityLevel, ExtendedConformityLevel, BasicIndividualConformityLevel, RegularIndividualConformityLevel, ExtendedIndividualConformityLevel }
enum ObjectId { VendorNameObjectId, ProductCodeObjectId, MajorMinorRevisionObjectId, VendorUrlObjectId, ProductNameObjectId, …, UndefinedObjectId }
enum ReadDeviceIdCode { BasicReadDeviceIdCode, RegularReadDeviceIdCode, ExtendedReadDeviceIdCode, IndividualReadDeviceIdCode }

Public Functions

QModbusDeviceIdentification::ConformityLevel conformityLevel() const
bool contains(uint objectId) const
bool insert(uint objectId, const QByteArray &value)
bool isValid() const
QList<int> objectIds() const
void remove(uint objectId)
void setConformityLevel(QModbusDeviceIdentification::ConformityLevel level)
QByteArray value(uint objectId) const

Static Public Members

QModbusDeviceIdentification fromByteArray(const QByteArray &ba)

Detailed Description

The Device Identification interface is modeled as an address space composed of a set of addressable data elements. The data elements are called objects and an ObjectId identifies them.

Member Type Documentation

enum QModbusDeviceIdentification::ConformityLevel

Defines the identification conformity level of the device and type of supported access.

QModbusDeviceIdentification::BasicConformityLevel0x01Basic identification (stream access).
QModbusDeviceIdentification::RegularConformityLevel0x02Regular identification (stream access).
QModbusDeviceIdentification::ExtendedConformityLevel0x03Extended identification (stream access).
QModbusDeviceIdentification::BasicIndividualConformityLevel0x81Basic identification (stream access and individual access).
QModbusDeviceIdentification::RegularIndividualConformityLevel0x82Regular identification (stream access and individual access).
QModbusDeviceIdentification::ExtendedIndividualConformityLevel0x83Extended identification (stream access and individual access).

See also ReadDeviceIdCode.

enum QModbusDeviceIdentification::ObjectId

This enum describes the possible server objects. The interface consists of three categories of objects:

Basic Device Identification. All objects of this category are mandatory.

QModbusDeviceIdentification::VendorNameObjectId0x00The vendor name of the device.
QModbusDeviceIdentification::ProductCodeObjectId0x01The product code of the device.
QModbusDeviceIdentification::MajorMinorRevisionObjectId0x02The product version numbering.

Regular Device Identification. All objects of this category are standard defined and optional.

QModbusDeviceIdentification::VendorUrlObjectId0x03The vendor URL of the device.
QModbusDeviceIdentification::ProductNameObjectId0x04The product name of the device.
QModbusDeviceIdentification::ModelNameObjectId0x05The model name of the device.
QModbusDeviceIdentification::UserApplicationNameObjectId0x06The user application name of the device.

Reserved range (i.e., ReservedObjectId >= ObjectId < ProductDependentObjectId). Do not use.

QModbusDeviceIdentification::ReservedObjectId0x07First value of reserved object Ids.

Extended Device Identification. All of these data are device dependent and optional.

QModbusDeviceIdentification::ProductDependentObjectId0x80First possible value of product dependent identifiers.
QModbusDeviceIdentification::UndefinedObjectId0x100Do not use.

enum QModbusDeviceIdentification::ReadDeviceIdCode

Defines the access type of the read identification request.

Stream access:

QModbusDeviceIdentification::BasicReadDeviceIdCode0x01Request to get the basic device identification.
QModbusDeviceIdentification::RegularReadDeviceIdCode0x02Request to get the regular device identification.
QModbusDeviceIdentification::ExtendedReadDeviceIdCode0x03Request to get the extended device identification.

Individual access:

QModbusDeviceIdentification::IndividualReadDeviceIdCode0x04Request to get one specific identification object.

Member Function Documentation


Constructs an invalid QModbusDeviceIdentification object.

QModbusDeviceIdentification::ConformityLevel QModbusDeviceIdentification::conformityLevel() const

Returns the identification conformity level of the device and type of supported access.

See also setConformityLevel().

bool QModbusDeviceIdentification::contains(uint objectId) const

Returns true if there is an item for the given objectId; otherwise false.

See also ObjectId.

[static] QModbusDeviceIdentification QModbusDeviceIdentification::fromByteArray(const QByteArray &ba)

Converts the byte array ba to a QModbusDeviceIdentification object.

Note: : The returned object might be empty or even invalid if some error occurs while processing the byte array.

See also isValid().

bool QModbusDeviceIdentification::insert(uint objectId, const QByteArray &value)

Inserts a new item with the objectId and a value of value. If there is already an item with the objectId, that item's value is replaced with value.

Returns true if the size of value is less than 245 bytes and the objectId is less then QModbusDeviceIdentification::UndefinedObjectId.

See also ObjectId.

bool QModbusDeviceIdentification::isValid() const

Returns true if the device identification object is valid; otherwise false.

A device identification object is considered valid if ProductNameObjectId, ProductCodeObjectId and MajorMinorRevisionObjectId are set to a non-empty value. Still the object can contain valid object id's and associated data.

Note: A default constructed device identification object is invalid.

QList<int> QModbusDeviceIdentification::objectIds() const

Returns a list containing all the object id's in the QModbusDeviceIdentification object in ascending order.

See also ObjectId.

void QModbusDeviceIdentification::remove(uint objectId)

Removes the item for the given objectId.

See also ObjectId.

void QModbusDeviceIdentification::setConformityLevel(QModbusDeviceIdentification::ConformityLevel level)

Sets the identification conformity level of the device and type of supported access to level.

See also conformityLevel().

QByteArray QModbusDeviceIdentification::value(uint objectId) const

Returns the value associated with the objectId. If there is no item with the objectId, the function returns a default-constructed value.

See also ObjectId.

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