IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QCanMessageDescription Class

The QCanMessageDescription class describes the rules to process a CAN message and represent it in an application-defined format.

This class was introduced in Qt 6.5.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QCanMessageDescription Class

  • Header: QCanMessageDescription

  • Since: Qt 6.5

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS SerialBus)

    target_link_libraries(mytarget PRIVATE Qt6::SerialBus)

  • qmake: QT += serialbus

This class is under development and is subject to change.

I. 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.

I-1. 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.

I-2. 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.

I-3. See Also

II. Member Function Documentation

 

II-1. QCanMessageDescription::QCanMessageDescription()

Creates an empty message description.

II-2. QCanMessageDescription::QCanMessageDescription(const QCanMessageDescription &other)

Creates a message description with the values copied from other.

II-3. 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.

II-4. QCanMessageDescription::~QCanMessageDescription()

Destroys this message description.

II-5. void QCanMessageDescription::addSignalDescription(const QCanSignalDescription &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.

II-5-1. See Also

II-6. void QCanMessageDescription::clearSignalDescriptions()

Clears all the signal descriptions of this message.

II-6-1. See Also

II-7. QString QCanMessageDescription::comment() const

Returns the comment for the message.

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

II-7-1. See Also

See also setComment()

II-8. bool QCanMessageDescription::isValid() const

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.

II-8-1. See Also

II-9. QString QCanMessageDescription::name() const

Returns the name of the CAN message.

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

II-9-1. See Also

See also setName()

II-10. void QCanMessageDescription::setComment(const QString &text)

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.

II-10-1. See Also

See also comment()

II-11. void QCanMessageDescription::setName(const QString &name)

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.

II-11-1. See Also

See also name()

II-12. void QCanMessageDescription::setSignalDescriptions(const QList<QCanSignalDescription> &descriptions)

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.

II-12-1. See Also

II-13. void QCanMessageDescription::setSize(quint8 size)

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

II-13-1. See Also

See also size()

II-14. void QCanMessageDescription::setTransmitter(const QString &transmitter)

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.

II-14-1. See Also

See also transmitter()

II-15. void QCanMessageDescription::setUniqueId(QtCanBus::UniqueId id)

Sets the unique identifier of the CAN message to id.

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

II-15-1. See Also

See also uniqueId()

II-16. QCanSignalDescription QCanMessageDescription::signalDescriptionForName(const QString &name) const

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.

II-16-1. See Also

II-17. QList<QCanSignalDescription> QCanMessageDescription::signalDescriptions() const

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

II-17-1. See Also

II-18. quint8 QCanMessageDescription::size() const

Returns the size in bytes of the CAN message.

II-18-1. See Also

See also setSize()

II-19. QString QCanMessageDescription::transmitter() const

Returns the transmitter node of the message.

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

II-19-1. See Also

See also setTransmitter()

II-20. QtCanBus::UniqueId QCanMessageDescription::uniqueId() const

Returns the unique identifier of the CAN message.

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

II-20-1. See Also

See also setUniqueId()

II-21. QCanMessageDescription &QCanMessageDescription::operator=(const QCanMessageDescription &other)

Assigns the values from other to this message description.

II-22. 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.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+