Bus Transmitter Module
- class mtf.network_port.bus_transmitter.BusTransmitter
- abstract classmethod transmit_frame(*args, **kwargs)
Abstract method that transmits a frame.
- Raises:
NotImplementedError: This method must be implemented by a subclass.
- class mtf.network_port.bus_transmitter.CanTransmitter
- transmitter
- 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)
- classmethod stop_transmit_cyclic_frame(channel_name: str, frame_id: int)
- class mtf.network_port.bus_transmitter.CanFdTransmitter
- classmethod transmit_frame(channel_name: str, frame_id: int, payload: List, bit_rate_switch=True)
Transmits a CANFD frame on the specified channel.
- Args:
channel_name (str): The name of the CANFD channel to transmit the frame on. frame_id (int): The ID of the CANFD 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)
- classmethod stop_transmit_cyclic_frame(channel_name: str, frame_id: int)
- transmitter
- class mtf.network_port.bus_transmitter.LinTransmitter
- transmitter
- classmethod transmit_frame(channel_name: str, frame_id: int, payload: List)
Abstract method that transmits a frame.
- Raises:
NotImplementedError: This method must be implemented by a subclass.
- classmethod wake_up_lin_bus(channel_name: str)
Wakes up the LIN bus on the associated channel (Async Wake up sending). args:
channel_name (str)
- Returns:
bool: True if the LIN bus wakes up successfully, False otherwise.
- classmethod get_state(channel_name: str)
get the LIN bus state on the associated channel. args:
channel_name (str)
- Returns:
- EnumInit
Operational : node is awake Sleep : node in sleep mode
- class mtf.network_port.bus_transmitter.FlexrayTransmitter
- transmitter
- classmethod transmit_frame(channel_name: str, frame_id: str, payload: ~typing.List, communication_channel: ~mtf.enum_types.FRCommunicationChannel = <FRCommunicationChannel.A: 0>, transmission_mode: ~mtf.enum_types.TransmissionMode = TransmissionMode.SingleShot)
Abstract method that transmits a frame.
- Raises:
NotImplementedError: This method must be implemented by a subclass.
- classmethod stop_transmit(channel_name: str, frame_id: str | int, communication_channel: ~mtf.enum_types.FRCommunicationChannel = <FRCommunicationChannel.A: 0>)
- classmethod activate_wake_up(channel_name: str, do_wake_up: bool)
Activate wake up for a given channel args:
channel_name (str): The channel name do_wake_up (bool) Whether to wake up the FLEXRAY bus when the bus sleeps automatically
- Returns:
bool: True if the FLEXRAY bus wakes up successfully, False otherwise.
- class mtf.network_port.bus_transmitter.EthernetTransmitter
- transmitter
- lock
- classmethod transmit_frame(channel_name: str, payload: List)
Abstract method that transmits a frame.
- Raises:
NotImplementedError: This method must be implemented by a subclass.
- classmethod transmit_frame_queue(channel_name: str, timestamped_queue: List[tuple[int, List[int]]])
transmit queue of packets with respect to the delays between successive frames. timestamped_queue contains list tuples, ech tuple contains:
first the delay between the previous message and the current message second the payload to be sent
- note:
first delay means we will send the packets immediately or after certain delay. delay is in nanoseconds
[(0,[1,2,3]), (2,[1,2,3]) …..]
- classmethod configure_frame_queue(channel_name: str, timestamped_queue: List[tuple[int, List[int]]])
Configure an ethernet frame queue transmission by specifying the dedicated channel and timestamped_queue.
- Parameters:
channel_name – name of the ethernet channel to be configured.
timestamped_queue –
- contains list tuples, each tuple contains:
first the delay between the previous message and the current message
second the payload to be sent
- note:
first delay means we will send the packets immediately or after certain delay. delay is in nanoseconds
- Returns:
True if the queue transmission is configured. False otherwise.
Examples: >>> MtfBase.bus_manager.bus_transmitter(BusType.ETHERNET).configure_frame_queue(“ethernet_channel_name”, [(0,[1,2,3]), (2,[1,2,3]) …..])
- classmethod start_frame_queue(channel_name: str)
Start transmission of the ethernet queue associated with the given channel. For the transmission to occur, it must first be configured.
- Parameters:
channel_name – name of the ethernet channel.
- Returns:
True if the queue transmission task is triggered. False otherwise.
Examples: >>> MtfBase.bus_manager.bus_transmitter(BusType.ETHERNET).start_frame_queue(“ethernet_channel_name”)