QCanUniqueIdDescription Class | Qt Serial Bus | Qt 6.10.2
Description: The QCanUniqueIdDescription class describes the rules for accessing a unique identifier in a QCanBusFrame.

- Qt 6.10
- Qt Serial Bus
- C++ Classes
- QCanUniqueIdDescription
- Qt 6.10.2 Reference Documentation

# QCanUniqueIdDescription Class

The QCanUniqueIdDescription class describes the rules for accessing a unique identifier in a QCanBusFrame. More...

Header: | `#include <QCanUniqueIdDescription>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS SerialBus)` `target_link_libraries(mytarget PRIVATE Qt6::SerialBus)`
qmake: | `QT += serialbus`
Since: | Qt 6.5
Status: | Preliminary

This class is under development and is subject to change.

- List of all members, including inherited members

## Public Functions

| QCanUniqueIdDescription(QCanUniqueIdDescription &&other)
| ~QCanUniqueIdDescription()
Q_DECL_IMPORT | setBitLength(int length)
Q_DECL_IMPORT | setSource(QtCanBus::DataSource source)
Q_DECL_IMPORT | setStartBit(int bit)
QCanUniqueIdDescription & | operator=(QCanUniqueIdDescription &&other)

## Detailed Description

A unique identifier is used to distinguish different CAN bus frames and apply proper QCanMessageDescriptions to encode or decode them. Different CAN protocols can use different parts of the CAN frame as a unique identifier (e.g. the DBC protocol uses the whole FrameId as a unique identifier).

This class contains parameters to specify the unique identifier position within a CAN frame in a flexible way:

- The part of the frame which will be used to extract the unique identifier (FrameId or payload).
- The start bit of the unique identifier, relative to the selected part of the frame. The bits are counted starting from the LSB.
- The number of bits used to represent the unique identifier.
- The endian used to extract the value.

Check the Data Endianness Processing section of the QCanSignalDescription documentation to see how the start bit value depends on the data endianness. The approach that is described there is also used for unique id description.

The actual value of a unique identifier is represented by the QtCanBus::UniqueId type.

See also QCanMessageDescription.

## Member Function Documentation

### `[constexpr noexcept]` QCanUniqueIdDescription::QCanUniqueIdDescription(QCanUniqueIdDescription &&other)

Creates a unique identifier description by moving from other.

Note: The moved-from QCanUniqueIdDescription object can only be destroyed or assigned to. The effect of calling other functions than the destructor or one of the assignment operators is undefined.

### `[constexpr noexcept]` QCanUniqueIdDescription::~QCanUniqueIdDescription()

Destroys this unique identifier description.

### Q_DECL_IMPORT QCanUniqueIdDescription::setBitLength(int length)

Sets the bit length of the unique identifier to length.

See also bitLength(), startBit(), and setStartBit().

### Q_DECL_IMPORT QCanUniqueIdDescription::setSource(QtCanBus::DataSource source)

Sets the data source of the unique identifier to source.

See also source() and QtCanBus::DataSource.

### Q_DECL_IMPORT QCanUniqueIdDescription::setStartBit(int bit)

Sets the start bit of the unique identifier in the source() to bit.

See also startBit(), bitLength(), and setBitLength().

### `[noexcept default]` QCanUniqueIdDescription &QCanUniqueIdDescription::operator=(QCanUniqueIdDescription &&other)

Move-assigns the values from other to this unique identifier description.

Note: The moved-from QCanUniqueIdDescription object can only be destroyed or assigned to. The effect of calling other functions than the destructor or one of the assignment operators is undefined.