QCanMessageDescription Class | Qt Serial Bus | Qt 6.10.2
Description: The QCanMessageDescription class describes the rules to process a CAN message and represent it in an application-defined format.

- Qt 6.10
- Qt Serial Bus
- C++ Classes
- QCanMessageDescription
- Qt 6.10.2 Reference Documentation

# QCanMessageDescription Class

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

Header: | `#include <QCanMessageDescription>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS SerialBus)` `target_link_libraries(mytarget PRIVATE Qt6::SerialBus)`
qmake: | `QT += serialbus`
Since: | Qt 6.5
Status: | Preliminary

This class is under development and is subject to change.

- List of all members, including inherited members

## Public Functions

| QCanMessageDescription(QCanMessageDescription &&other)
| ~QCanMessageDescription()
Q_DECL_IMPORT | addSignalDescription(const class QCanSignalDescription &description)
Q_DECL_IMPORT | clearSignalDescriptions()
Q_DECL_IMPORT | setComment(const int &text)
Q_DECL_IMPORT | setName(const int &name)
Q_DECL_IMPORT | setSignalDescriptions(const int &descriptions)
Q_DECL_IMPORT | setSize(int size)
Q_DECL_IMPORT | setTransmitter(const int &transmitter)
Q_DECL_IMPORT | setUniqueId(QtCanBus::UniqueId id)
QCanMessageDescription & | operator=(QCanMessageDescription &&other)

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

See also QCanSignalDescription and QCanUniqueIdDescription.

## Member Function Documentation

### `[constexpr noexcept]` QCanMessageDescription::QCanMessageDescription(QCanMessageDescription &&other)

Creates a message description by moving from other.

Note: 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.

### `[constexpr noexcept]` QCanMessageDescription::~QCanMessageDescription()

Destroys this message description.

### Q_DECL_IMPORT QCanMessageDescription::addSignalDescription(const class 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.

See also signalDescriptions(), signalDescriptionForName(), setSignalDescriptions(), and clearSignalDescriptions().

### Q_DECL_IMPORT QCanMessageDescription::clearSignalDescriptions()

Clears all the signal descriptions of this message.

See also signalDescriptions(), signalDescriptionForName(), addSignalDescription(), and setSignalDescriptions().

### Q_DECL_IMPORT QCanMessageDescription::setComment(const int &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.

See also comment().

### Q_DECL_IMPORT QCanMessageDescription::setName(const int &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.

See also name().

### Q_DECL_IMPORT QCanMessageDescription::setSignalDescriptions(const int &descriptions)

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.

See also signalDescriptions(), signalDescriptionForName(), addSignalDescription(), and clearSignalDescriptions().

### Q_DECL_IMPORT QCanMessageDescription::setSize(int size)

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

See also size().

### Q_DECL_IMPORT QCanMessageDescription::setTransmitter(const int &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.

See also transmitter().

### Q_DECL_IMPORT 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.

See also uniqueId().

### `[noexcept default]` QCanMessageDescription &QCanMessageDescription::operator=(QCanMessageDescription &&other)

Move-assigns the values from other to this message description.

Note: 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.