The QModbusDeviceIdentification is a container class representing the physical and functional description of a Modbus server. 更多...
头: | #include <QModbusDeviceIdentification> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS SerialBus)
target_link_libraries(mytarget PRIVATE Qt6::SerialBus) |
qmake: | QT += serialbus |
enum | ConformityLevel { BasicConformityLevel, RegularConformityLevel, ExtendedConformityLevel, BasicIndividualConformityLevel, RegularIndividualConformityLevel, ExtendedIndividualConformityLevel } |
enum | ObjectId { VendorNameObjectId, ProductCodeObjectId, MajorMinorRevisionObjectId, VendorUrlObjectId, ProductNameObjectId, …, UndefinedObjectId } |
enum | ReadDeviceIdCode { BasicReadDeviceIdCode, RegularReadDeviceIdCode, ExtendedReadDeviceIdCode, IndividualReadDeviceIdCode } |
QModbusDeviceIdentification () | |
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 |
QModbusDeviceIdentification | fromByteArray (const QByteArray & ba ) |
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.
Defines the identification conformity level of the device and type of supported access.
常量 | 值 | 描述 |
---|---|---|
QModbusDeviceIdentification::BasicConformityLevel
|
0x01
|
Basic identification (stream access). |
QModbusDeviceIdentification::RegularConformityLevel
|
0x02
|
Regular identification (stream access). |
QModbusDeviceIdentification::ExtendedConformityLevel
|
0x03
|
Extended identification (stream access). |
QModbusDeviceIdentification::BasicIndividualConformityLevel
|
0x81
|
Basic identification (stream access and individual access). |
QModbusDeviceIdentification::RegularIndividualConformityLevel
|
0x82
|
Regular identification (stream access and individual access). |
QModbusDeviceIdentification::ExtendedIndividualConformityLevel
|
0x83
|
Extended identification (stream access and individual access). |
另请参阅 ReadDeviceIdCode .
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::VendorNameObjectId
|
0x00
|
The vendor name of the device. |
QModbusDeviceIdentification::ProductCodeObjectId
|
0x01
|
The product code of the device. |
QModbusDeviceIdentification::MajorMinorRevisionObjectId
|
0x02
|
The product version numbering. |
Regular Device Identification. All objects of this category are standard defined and optional.
常量 | 值 | 描述 |
---|---|---|
QModbusDeviceIdentification::VendorUrlObjectId
|
0x03
|
The vendor URL of the device. |
QModbusDeviceIdentification::ProductNameObjectId
|
0x04
|
The product name of the device. |
QModbusDeviceIdentification::ModelNameObjectId
|
0x05
|
The model name of the device. |
QModbusDeviceIdentification::UserApplicationNameObjectId
|
0x06
|
The user application name of the device. |
Reserved range (i.e., ReservedObjectId >= ObjectId < ProductDependentObjectId). Do not use.
常量 | 值 | 描述 |
---|---|---|
QModbusDeviceIdentification::ReservedObjectId
|
0x07
|
First value of reserved object Ids. |
Extended Device Identification. All of these data are device dependent and optional.
常量 | 值 | 描述 |
---|---|---|
QModbusDeviceIdentification::ProductDependentObjectId
|
0x80
|
First possible value of product dependent identifiers. |
QModbusDeviceIdentification::UndefinedObjectId
|
0x100
|
Do not use. |
Defines the access type of the read identification request.
Stream access:
常量 | 值 | 描述 |
---|---|---|
QModbusDeviceIdentification::BasicReadDeviceIdCode
|
0x01
|
Request to get the basic device identification. |
QModbusDeviceIdentification::RegularReadDeviceIdCode
|
0x02
|
Request to get the regular device identification. |
QModbusDeviceIdentification::ExtendedReadDeviceIdCode
|
0x03
|
Request to get the extended device identification. |
Individual access:
常量 | 值 | 描述 |
---|---|---|
QModbusDeviceIdentification::IndividualReadDeviceIdCode
|
0x04
|
Request to get one specific identification object. |
[constexpr noexcept]
QModbusDeviceIdentification::
QModbusDeviceIdentification
()
Constructs an invalid QModbusDeviceIdentification object.
Returns the identification conformity level of the device and type of supported access.
另请参阅 setConformityLevel ().
返回
true
if there is an item for the given
objectId
;否则
false
.
另请参阅 ObjectId .
[static]
QModbusDeviceIdentification
QModbusDeviceIdentification::
fromByteArray
(const
QByteArray
&
ba
)
Converts the byte array ba 到 QModbusDeviceIdentification 对象。
注意: : The returned object might be empty or even invalid if some error occurs while processing the byte array.
另请参阅 isValid ().
插入新项具有 objectId 和值 value . If there is already an item with the objectId , that item's value is replaced with value .
返回
true
if the size of
value
is less than 245 bytes and the
objectId
is less then
QModbusDeviceIdentification::UndefinedObjectId
.
另请参阅 ObjectId .
返回
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.
注意: A default constructed device identification object is invalid.
Returns a list containing all the object id's in the
QModbusDeviceIdentification
object in ascending order.
另请参阅 ObjectId .
Removes the item for the given objectId .
另请参阅 ObjectId .
Sets the identification conformity level of the device and type of supported access to level .
另请参阅 conformityLevel ().
返回值关联 objectId . If there is no item with the objectId , the function returns a 默认构造值 .
另请参阅 ObjectId .