Message

class canlib.kvadblib.Message(db, handle, name=None, id=None, flags=None, dlc=None, comment=None)[source]

Database message, holds signals.

asframe()[source]

Returns a Frame object with flags and empty data matching this message

Changed in version 1.21: Now includes support for CAN FD signals in dbc file introduced in CANlib SDK v5.39 by using the canflags properties.

attributes()[source]

Return a generator over all message attributes.

bind(frame=None)[source]

Bind this message to a frame

Creates a new BoundMessage object representing this message bound to the given Frame object, or a new Frame object if frame is None.

property canflags

Relevant message attributes expressed as canlib.MessageFlag

Note that canlib.MessageFlag.BRS will never be returned for non-CAN FD frames, even though the CANFD_BRS attribute was set in the .dbc file.

New in version 1.21.

Type:

canlib.MessageFlag

property comment

Message comment

Type:

str

delete_attribute(name)[source]

Delete attribute from message.

delete_signal(signal)[source]

Delete signal from message.

Parameters:

signal (Signal) – signal to be deleted

property dlc

The message dlc

Type:

int

property flags

The message flags

Type:

MessageFlag

get_attribute_value(name)[source]

Return attribute value

If the attribute is not set on the message, we return the attribute definition default value.

Changed in version 1.18: When an EnumAttribute is not set, the default value will now be returned as int (instead of EnumValue with empty name).

get_signal(name)[source]

Find signal in message by name.

get_signal_by_name(name)[source]

Find signal in message by name.

property id

The message identifier

Type:

int

property name

The message name

Type:

str

new_signal(name, type=SignalType.UNSIGNED, byte_order=SignalByteOrder.INTEL, mode=SignalMultiplexMode.SIGNAL, representation=None, size=None, scaling=None, limits=None, unit=None, comment=None, enums=None)[source]

Create and add a new signal to the message.

property qualified_name

The qualified message name

Returns database and message names separated by a dot.

Type:

str

property send_node

The send node for this message.

Type:

Node

set_attribute_value(name, value)[source]

Set value of attribute ‘name’ on message.

If no attribute called ‘name’ is set on message, attach a message attribute from the database attribute definition first.

signals()[source]

Return a generator of all signals in message.