LastFrame

class mtf.network_port.iso_tp.custom_fr_tp.fr_tp_frames.LastFrame

Inherits from the BaseFrame class and represents a specific type of frame

PCI_SIZE = 4
FPL_OFFSET = 5
LENGTH_OFFSET = 6
PAYLOAD_OFFSET = 8
__init__(source_address: int = 0, target_address: int = 0, message_length: int = 0, payload: List[int] = []) None
to_payload() List[int]

Convert the attributes of a LastFrame instance into a binary representation as a FramePayload

Returns:

list[int]

from_payload(payload: List[int]) bool

Extract and initialize the attributes of a LastFrame instance from a FramePayload object

Args:

payload (FramePayload): The payload to be sent

Returns:

bool: If this extraction fails, the method returns False

property Frame_Payload_Length

Provides read access to the _fpl attribute

Returns:

int: fpl

property Message_Length

Provides read access to the _message_length attribute

Returns:

int: message length

property Payload_Data

Provides read access to the _payload attribute

Returns:

list[int]: payload

classmethod max_payload_length(pdu_length: int)

Calculate the maximum length of the payload that a frame can contain

Args:

pdu_length (int)

Returns:

int: maximum length of the payload

PCI_OFFSET = 4
SRC_ADDR_OFFSET = 2
TGT_ADDR_OFFSET = 0
property address_information

Create a list called payload initialized with zeros

Returns:

list[int]: contains address information formatted in a specific way

classmethod get_pci_type(payload: List[int])

Extract and return the PCI type from a FramePayload

Args:

payload (FramePayload): The payload to be sent

Returns:

int: returns an integer representing the PCI type, or 0 if the extraction fails

classmethod get_source_address(payload: List[int]) Tuple[bool, int]

Extract a source address from a FramePayload

Args:

payload (FramePayload): The payload to be sent

Returns:
Tuple[bool, int]: bool: Indicates whether the extraction was successful or not

int: The extracted source address (if the extraction is successful), otherwise 0

classmethod get_target_address(payload: List[int]) Tuple[bool, int]

Extract a target address from a FramePayload

Args:

payload (FramePayload): The payload to be sent

Returns:
Tuple[bool, int]: bool: Indicates whether the extraction was successful or not

int: The extracted target address (if the extraction is successful), otherwise 0

parse_address_information(payload: List[int]) bool

Extract address information from a FramePayload and update the object’s attributes

Args:

payload (FramePayload): The payload to be sent

Returns:

bool: Returns True if all extraction and update operations were successful

property source_address

Provides read access to the _source_address attribute

Returns:

int: source address

property target_address

Provides read access to the _target_address attribute

Returns:

int: target address