CanTransmitter

class mtf.network_port.bus_transmitter.CanTransmitter

Manage data transmission specifically on a CAN bus

transmitter = <mtf.libs.mtf_pybinder.mtf_can_transmitter object>
classmethod transmit_frame(channel_name: str, frame_id: int, payload: List, bit_rate_switch=True)

Transmits a CAN frame on the specified channel.

Args:

channel_name (str): The name of the CAN channel to transmit the frame on. frame_id (int): The ID of the CAN frame to transmit. payload (FramePayload): The payload of the CAN frame to transmit. bit_rate_switch (bool, optional): Whether to use the bit rate switch (BRS) feature

True -> BRS.ON False -> BRS.OFF Defaults to False.

Returns:

bool: True if succeeded

classmethod start_transmit_cyclic_frame(channel_name: str, frame_id: int, payload: List, cycle: int)

Initiates the cyclic transmission of a CAN frame on a specific channel Args:

channel_name (str): The channel name frame_id (int): The ID of the CAN frame payload (FramePayload): The payload of the CAN frame to transmit cycle (int): Cycle duration

Return:

bool: The method returns True if the cyclic transmission was started successfully, or False if it failed

classmethod stop_transmit_cyclic_frame(channel_name: str, frame_id: int)

Stops the cyclic transmission of a CAN frame Args:

channel_name (str): The channel name frame_id (int): The ID of the CAN frame

Return:

bool: True if the cyclic transmission was successfully stopped, False otherwise