class QCanMessageDescription#

The QCanMessageDescription class describes the rules to process a CAN message and represent it in an application-defined format. 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 CAN message is basically a QCanBusFrame . The description of a CAN message includes the following:

  • Message ID.

  • Message name.

  • Message length in bytes.

  • Source of the message (transmitter).

  • Description of signals in the message.

The QCanMessageDescription class provides methods to control all those parameters.

Message ID#

The message ID is a unique identifier, which is used to select the proper message description when decoding the incoming QCanBusFrame or encoding a QCanBusFrame based on the provided data.

See QCanUniqueIdDescription documentation for more details on the unique identifier description.

Signal Description#

The signal description is represented by the QCanSignalDescription class. The QCanMessageDescription class only provides a list of signals that belong to the message.

__init__()#

Creates an empty message description.

__init__(other)
Parameters:

otherQCanMessageDescription

Creates a message description with the values copied from other.

addSignalDescription(description)#
Parameters:

descriptionQCanSignalDescription

Adds a new signal description description to this message description.

If the message description already has a signal description for a signal with the same name, it is overwritten.

clearSignalDescriptions()#

Clears all the signal descriptions of this message.

comment()#
Return type:

str

Returns the comment for the message.

This parameter is introduced only for extra description. It’s not used during message encoding or decoding.

See also

setComment()

isValid()#
Return type:

bool

Returns true when the message description is valid and false otherwise.

A valid message description must have at least one signal description. All signal descriptions must be valid as well.

name()#
Return type:

str

Returns the name of the CAN message.

This parameter is introduced only for extra description. It’s not used during message encoding or decoding.

See also

setName()

setComment(text)#
Parameters:

text – str

Sets the comment for the message to text.

This parameter is introduced only for extra description. It’s not used during message encoding or decoding.

See also

comment()

setName(name)#
Parameters:

name – str

Sets the name of the CAN message to name.

This parameter is introduced only for extra description. It’s not used during message encoding or decoding.

See also

name()

setSignalDescriptions(descriptions)#
Parameters:

descriptions – .list of QCanSignalDescription

Sets the descriptions of the signals belonging to this message description to descriptions.

Note

Message description must have signal descriptions with unique signal names, so if the descriptions list contains entries with duplicated names, only the last entry will be added.

setSize(size)#
Parameters:

size – int

Sets the size in bytes of the CAN message to size.

See also

size()

setTransmitter(transmitter)#
Parameters:

transmitter – str

Sets the transmitter node of the message to transmitter.

This parameter is introduced only for extra description. It’s not used during message encoding or decoding.

See also

transmitter()

setUniqueId(id)#
Parameters:

idUniqueId

Sets the unique identifier of the CAN message to id.

See the Message ID section for more information about the unique identifier.

See also

uniqueId()

signalDescriptionForName(name)#
Parameters:

name – str

Return type:

QCanSignalDescription

Returns the signal description of a signal with the name name.

If the message description does not have such signal description, a default-constructed QCanSignalDescription object is returned.

signalDescriptions()#
Return type:

.list of QCanSignalDescription

Returns the list of signal descriptions that belong to this message description.

size()#
Return type:

int

Returns the size in bytes of the CAN message.

See also

setSize()

swap(other)#
Parameters:

otherQCanMessageDescription

transmitter()#
Return type:

str

Returns the transmitter node of the message.

This parameter is introduced only for extra description. It’s not used during message encoding or decoding.

See also

setTransmitter()

uniqueId()#
Return type:

UniqueId

Returns the unique identifier of the CAN message.

See the Message ID section for more information about the unique identifier.

See also

setUniqueId()