PySide6.QtSerialBus.QCanUniqueIdDescription

class QCanUniqueIdDescription

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

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

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.

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 UniqueId type.

__init__()

Creates an empty unique identifier description.

__init__(other)
Parameters:

otherQCanUniqueIdDescription

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

bitLength()
Return type:

int

Returns the bit length of the unique identifier.

endian()
Return type:

Endian

Returns the data endian of the unique identifier.

By default, LittleEndian is used.

See also

setEndian() Endian

isValid()
Return type:

bool

Returns true when this unique identifier description is valid and false otherwise.

A valid unique identifier description must have a bitLength() which is greater than zero and does not exceed the number of bits of the UniqueId type.

See also

bitLength()

setBitLength(length)
Parameters:

length – int

Sets the bit length of the unique identifier to length.

setEndian(endian)
Parameters:

endianEndian

Sets the data endian of the unique identifier to endian.

See also

endian() Endian

setSource(source)
Parameters:

sourceDataSource

Sets the data source of the unique identifier to source.

See also

source() DataSource

setStartBit(bit)
Parameters:

bit – int

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

source()
Return type:

DataSource

Returns the data source of the unique identifier.

By default, FrameId is used.

startBit()
Return type:

int

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

swap(other)
Parameters:

otherQCanUniqueIdDescription