CanTransmitter
- class mtf.network_port.bus_transmitter.CanTransmitter
This class implements functionality for CAN frames transmissions.
- transmitter = <mtf.libs.mtf_pybinder.mtf_can_transmitter object>
- classmethod transmit_frame(channel_name: str, frame_id: int, payload: List, bit_rate_switch=True, error_flags: int = 0)
Transmits the given CAN frame on the specific 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 True.
- error_flags (int): Whether to set a CRC error.
Defaults to 0.
- Returns:
bool: True on success; False otherwise.
- classmethod start_transmit_cyclic_frame(channel_name: str, frame_id: int, payload: List, cycle: int)
Transmits the given frame cyclically on a specific channel.
- Args:
channel_name (str): The channel name to transmit over. frame_id (int): The ID of the CAN frame to transmit. payload (FramePayload): The payload of the CAN frame to transmit. cycle (int): The cycle duration (in ms).
- Returns:
- bool: True if the cyclic transmission was started successfully;
otherwise, False.
- classmethod stop_transmit_cyclic_frame(channel_name: str, frame_id: int)
Stops the cyclic transmission of the given frame on the given channel.
- Args:
channel_name (str): The channel name. frame_id (int): The ID of the CAN frame.
- Returns:
- bool: True if the cyclic transmission was successfully stopped;
otherwise, False.