QCanUniqueIdDescription Class

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

头: #include <QCanUniqueIdDescription>
CMake: find_package(Qt6 REQUIRED COMPONENTS SerialBus)
target_link_libraries(mytarget PRIVATE Qt6::SerialBus)
qmake: QT += serialbus
Since: Qt 6.5
状态: Preliminary

该类在开发且可能改变。

公共函数

QCanUniqueIdDescription ()
QCanUniqueIdDescription (const QCanUniqueIdDescription & other )
QCanUniqueIdDescription (QCanUniqueIdDescription && other )
~QCanUniqueIdDescription ()
quint8 bitLength () const
QSysInfo::Endian endian () const
bool isValid () const
void setBitLength (quint8 length )
void setEndian (QSysInfo::Endian endian )
void setSource (QtCanBus::DataSource source )
void setStartBit (quint16 bit )
QtCanBus::DataSource source () const
quint16 startBit () const
QCanUniqueIdDescription & operator= (const QCanUniqueIdDescription & other )
QCanUniqueIdDescription & operator= (QCanUniqueIdDescription && other )

详细描述

A unique identifier is used to distinguish different CAN bus frames and apply proper QCanMessageDescription s 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.

检查 Data Endianness Processing 章节的 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 类型。

另请参阅 QCanMessageDescription .

成员函数文档编制

QCanUniqueIdDescription:: QCanUniqueIdDescription ()

Creates an empty unique identifier description.

QCanUniqueIdDescription:: QCanUniqueIdDescription (const QCanUniqueIdDescription & other )

Creates a unique identifier description with the values copied from other .

[noexcept] QCanUniqueIdDescription:: QCanUniqueIdDescription ( QCanUniqueIdDescription && other )

Creates a unique identifier description by moving from other .

注意: 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.

[noexcept] QCanUniqueIdDescription:: ~QCanUniqueIdDescription ()

Destroys this unique identifier description.

quint8 QCanUniqueIdDescription:: bitLength () const

Returns the bit length of the unique identifier.

另请参阅 setBitLength (), startBit (),和 setStartBit ().

QSysInfo::Endian QCanUniqueIdDescription:: endian () const

Returns the data endian of the unique identifier.

默认情况下, LittleEndian 被使用。

另请参阅 setEndian () 和 QSysInfo::Endian .

bool QCanUniqueIdDescription:: isValid () const

返回 true when this unique identifier description is valid and false 否则。

A valid unique identifier description must 拥有 bitLength () which is greater than zero and does not exceed the number of bits of the QtCanBus::UniqueId 类型。

另请参阅 bitLength ().

void QCanUniqueIdDescription:: setBitLength ( quint8 length )

Sets the bit length of the unique identifier to length .

另请参阅 bitLength (), startBit (),和 setStartBit ().

void QCanUniqueIdDescription:: setEndian ( QSysInfo::Endian endian )

Sets the data endian of the unique identifier to endian .

另请参阅 endian () 和 QSysInfo::Endian .

void QCanUniqueIdDescription:: setSource ( QtCanBus::DataSource source )

Sets the data source of the unique identifier to source .

另请参阅 source () 和 QtCanBus::DataSource .

void QCanUniqueIdDescription:: setStartBit ( quint16 bit )

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

另请参阅 startBit (), bitLength (),和 setBitLength ().

QtCanBus::DataSource QCanUniqueIdDescription:: source () const

Returns the data source of the unique identifier.

默认情况下, FrameId 被使用。

另请参阅 setSource () 和 QtCanBus::DataSource .

quint16 QCanUniqueIdDescription:: startBit () const

Returns the start bit of the unique identifier in the source ().

另请参阅 setStartBit (), bitLength (),和 setBitLength ().

QCanUniqueIdDescription &QCanUniqueIdDescription:: operator= (const QCanUniqueIdDescription & other )

Assigns the values from other to this unique identifier description.

[noexcept] QCanUniqueIdDescription &QCanUniqueIdDescription:: operator= ( QCanUniqueIdDescription && other )

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

注意: 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.