The QCanMessageDescription class describes the rules to process a CAN message and represent it in an application-defined format. 更多...
头: | #include <QCanMessageDescription> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS SerialBus)
target_link_libraries(mytarget PRIVATE Qt6::SerialBus) |
qmake: | QT += serialbus |
Since: | Qt 6.5 |
状态: | Preliminary |
该类在开发且可能改变。
QCanMessageDescription () | |
QCanMessageDescription (const QCanMessageDescription & other ) | |
QCanMessageDescription (QCanMessageDescription && other ) | |
~QCanMessageDescription () | |
void | addSignalDescription (const QCanSignalDescription & description ) |
void | clearSignalDescriptions () |
QString | comment () const |
bool | isValid () const |
QString | name () const |
void | setComment (const QString & text ) |
void | setName (const QString & name ) |
void | setSignalDescriptions (const QList<QCanSignalDescription> & descriptions ) |
void | setSize (quint8 size ) |
void | setTransmitter (const QString & transmitter ) |
void | setUniqueId (QtCanBus::UniqueId id ) |
QCanSignalDescription | signalDescriptionForName (const QString & name ) const |
QList<QCanSignalDescription> | signalDescriptions () const |
quint8 | size () const |
QString | transmitter () const |
QtCanBus::UniqueId | uniqueId () const |
QCanMessageDescription & | operator= (const QCanMessageDescription & other ) |
QCanMessageDescription & | operator= (QCanMessageDescription && other ) |
A CAN message is basically a QCanBusFrame . The description of a CAN message includes the following:
The QCanMessageDescription class provides methods to control all those parameters.
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.
见 QCanUniqueIdDescription documentation for more details on the unique identifier description.
The signal description is represented by the QCanSignalDescription class. The QCanMessageDescription class only provides a list of signals that belong to the message.
另请参阅 QCanSignalDescription and QCanUniqueIdDescription .
Creates an empty message description.
Creates a message description with the values copied from other .
[noexcept]
QCanMessageDescription::
QCanMessageDescription
(
QCanMessageDescription
&&
other
)
Creates a message description by moving from other .
注意: The moved-from QCanMessageDescription 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]
QCanMessageDescription::
~QCanMessageDescription
()
Destroys this message description.
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.
另请参阅 signalDescriptions (), signalDescriptionForName (), setSignalDescriptions (),和 clearSignalDescriptions ().
Clears all the signal descriptions of this message.
另请参阅 signalDescriptions (), signalDescriptionForName (), addSignalDescription (),和 setSignalDescriptions ().
Returns the comment for the message.
This parameter is introduced only for extra description. It's not used during message encoding or decoding.
另请参阅 setComment ().
返回
true
when the message description is valid and
false
否则。
A valid message description must have at least one signal description. All signal descriptions must be valid as well.
另请参阅 signalDescriptions () 和 QCanSignalDescription::isValid ().
Returns the name of the CAN message.
This parameter is introduced only for extra description. It's not used during message encoding or decoding.
另请参阅 setName ().
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.
另请参阅 comment ().
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.
另请参阅 name ().
Sets the descriptions of the signals belonging to this message description to descriptions .
注意: 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.
另请参阅 signalDescriptions (), signalDescriptionForName (), addSignalDescription (),和 clearSignalDescriptions ().
Sets the size in bytes of the CAN message to size .
另请参阅 size ().
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.
另请参阅 transmitter ().
Sets the unique identifier of the CAN message to id .
见 Message ID section for more information about the unique identifier.
另请参阅 uniqueId ().
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 (), addSignalDescription (), setSignalDescriptions (),和 clearSignalDescriptions ().
Returns the list of signal descriptions that belong to this message description.
另请参阅 signalDescriptionForName (), addSignalDescription (), setSignalDescriptions (),和 clearSignalDescriptions ().
Returns the size in bytes of the CAN message.
另请参阅 setSize ().
Returns the transmitter node of the message.
This parameter is introduced only for extra description. It's not used during message encoding or decoding.
另请参阅 setTransmitter ().
Returns the unique identifier of the CAN message.
见 Message ID section for more information about the unique identifier.
另请参阅 setUniqueId ().
Assigns the values from other to this message description.
[noexcept]
QCanMessageDescription
&QCanMessageDescription::
operator=
(
QCanMessageDescription
&&
other
)
Move-assigns the values from other to this message description.
注意: The moved-from QCanMessageDescription 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.