ConsecutiveFrame

class mtf.network_port.iso_tp.custom_fr_tp.fr_tp_frames.ConsecutiveFrame

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

PCI_SIZE = 2
FPL_OFFSET = 5
PAYLOAD_OFFSET = 6
__init__(source_address: int = 0, target_address: int = 0, sequence_number: int = 0, payload: List[int] = [], pci_type=FrPciType.CONSECUTIVE_FRAME_1) None
to_payload() List[int]

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

Returns:

list[int]

from_payload(payload: List[int]) bool

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

Args:

payload (FramePayload): The payload to be sent

Returns:

bool: If this extraction fails, the method returns False

property sequence_number

Provides read access to the _sequence_number attribute

Returns:

int: sequence number

property payload_data

Provides read access to the _payload attribute

Returns:

list[int]: payload

property frame_payload_length

Provides read access to the _fpl attribute

Returns:

int: fpl

classmethod next_sequence_number(sequence_number: int) int

Calculate the next sequence number in a context where sequence numbers are cyclic with a range of 16 values (0 to 15)

Args:

sequence_number (int)

Returns:

int

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