_can_auxiliary:

12. can_auxiliary

12.1. Can Auxiliary

module:

can_auxiliary

synopsis:

Auxiliary enables you to read write can messages which are defined in a dbc file.

The goal of this module is to be able to receive and send signals which are defined in dbc file.

class pykiso.lib.auxiliaries.can_auxiliary.CanAuxiliary(com, dbc_file, **kwargs)[source]

Auxiliary is used for reading and writing can messages defined in dbc file

Constructor.

Parameters:

com (CChannel) – CChannel that supports raw communication over CAN

get_last_message(message_name)[source]

Get the last message which has been received on the bus. :type message_name: str :param message_name: name of the message, you want to get

Return type:

Optional[CanMessage]

Returns:

last can massage or return none if the message, or return none if message is not occur

get_last_signal(message_name, signal_name)[source]

Get the last message which has been received on the bus. :type message_name: str :param message_name: name of the message, you want to get

Return type:

Optional[Any]

Returns:

last can massage or return none if the message or return none if message or signal is not occur

send_message(message, signals)[source]

Send one message, the message need to be defined in the dbc file.

Parameters:
  • message (str) – name of the message to send.

  • signals (dict[str, Any]) – dict of the signals of the message and their value.

Return type:

bool

Returns:

True or False if the message has been successfully send or not.

wait_for_message(message_name, timeout=0.2)[source]

Get the last message with certain timeout in seconds. :type message_name: str :param message_name: name of the message to receive :param timeout time to wait till a message receives in seconds

Return type:

dict[str, any]

Returns:

list of last can messages or None if no messages for this component

wait_to_match_message_with_signals(message_name, expected_signals, timeout=0.2)[source]

Get first message which matches the patter of signals .

Parameters:
  • message_name (str) – name of the message to receive

  • expected_signal – list of expected signals to match with message

:param timeout time to wait till a message receives in seconds

Return type:

dict[str, any]

Returns:

list of last can messages or None if no messages for this component