- class QCanMessageDescription¶
The
QCanMessageDescription
class describes the rules to process a CAN message and represent it in an application-defined format. More…Synopsis¶
Methods¶
def
__init__()
def
comment()
def
isValid()
def
name()
def
setComment()
def
setName()
def
setSize()
def
setTransmitter()
def
setUniqueId()
def
size()
def
swap()
def
transmitter()
def
uniqueId()
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 aQCanBusFrame
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. TheQCanMessageDescription
class only provides a list of signals that belong to the message.- __init__()¶
Creates an empty message description.
- __init__(other)
- Parameters:
other –
QCanMessageDescription
Creates a message description with the values copied from
other
.- addSignalDescription(description)¶
- Parameters:
description –
QCanSignalDescription
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
- isValid()¶
- Return type:
bool
Returns
true
when the message description is valid andfalse
otherwise.A valid message description must have at least one signal description. All signal descriptions must be valid as well.
See also
- 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
- 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
- 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
- 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
- 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
Sets the unique identifier of the CAN message to
id
.See the
Message ID
section for more information about the unique identifier.See also
- signalDescriptionForName(name)¶
- Parameters:
name – str
- Return type:
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
- swap(other)¶
- Parameters:
other –
QCanMessageDescription
- 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
Returns the unique identifier of the CAN message.
See the
Message ID
section for more information about the unique identifier.See also