EthernetTransmitter

class mtf.network_port.bus_transmitter.EthernetTransmitter

Manage data transmission specifically on a Ethernet bus

transmitter = <mtf.libs.mtf_pybinder.mtf_ethernet_transmitter object>
lock = <unlocked _thread.lock object>
classmethod transmit_frame(channel_name: str, payload: List)

Transmits a Ethernet frame on the specified channel

Args:

channel_name (str): The name of the Ethernet channel to transmit the frame on frame_id (int): The ID of the Ethernet frame to transmit payload (FramePayload): The payload of the CAN frame to transmit

Returns:

bool: True if succeeded

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”)

classmethod send_ethernet_packet(channel_name: str, packet: Packet)

transmit packet crafted by mtf_pcpp submodule

Parameters:

channel_name – name of the ethernet channel.

Returns:

None

Examples: >>> payload = [

0x04, 0xEC, 0xD8, 0xCC, 0xA0, 0x92, 0xAC, 0x71, 0x2E, 0x41, 0x6F, 0x03, 0x08, 0x00, 0x45, 0x00, 0x00, 0x43, 0xF7, 0x56, 0x40, 0x00, 0x6C, 0x11, 0x58, 0x6B, 0x28, 0x63, 0xDC, 0xA2, 0xAC, 0x10, 0x0D, 0xD2, 0x01, 0xBB, 0xFF, 0xA1, 0x00, 0x2F, 0xF2, 0x40, 0x4A, 0xA8, 0x26, 0x18, 0xAF, 0xFF, 0x3D, 0xF4, 0x09, 0xAA, 0x5B, 0x16, 0xD9, 0xE1, 0xC7, 0xF5, 0x09, 0x2A, 0xE8, 0xA9, 0x93, 0xD5, 0xE9, 0x44, 0x7A, 0xED, 0xC7, 0xDB, 0x37, 0x9E, 0xEC, 0x97, 0xC3, 0x81, 0xA3, 0x61, 0xA6, 0xEC, 0x04,

]

>>> udp_packet = np.array(payload,dtype=np.uint8)
>>> rp = RawPacket(udp_packet)
>>> my_packet = Packet(rp)
>>> MtfBase.bus_manager.bus_transmitter(BusType.ETHERNET).send_ethernet_packet("ethernet_channel_name", my_packet)