CustomCanTp

class mtf.network_port.iso_tp.custom_can_tp.CustomCanTp

Manages communication using a custom CAN TP protocol.

__init__()

CustomCanTp is a class for handling Custom CAN Transport Protocol (CAN TP) communication.

It provides methods for configuring and managing the communication over a CAN network, including sending and receiving messages using a custom CAN TP protocol.

Methods:

configure(config: IsoTpConfig) -> None: Configure the CAN TP with the provided configuration. configure_reception_flow_control(state, block_size, separation_time) -> None: Configure the reception flow control parameters. enable_faulty_speration_time(value: int) -> None: Enable faulty separation time with the given value. disable_faulty_speration_time() -> None: Disable faulty separation time. bind() -> bool: Bind the CAN TP for communication. close() -> bool: Close the CAN TP connection. send(payload: list[int]) -> bool: Send a message over the CAN TP. get_queue() -> list[FramePayload]: Get the list of received frames in the frame queue.

configure(config: IsoTpConfig)

Configure the CustomCanTp with the provided configuration.

Args:

config (IsoTpConfig): The configuration for the CAN TP communication.

configure_reception_flow_control(state, block_size, separation_time) None

Configure the reception flow control parameters.

Args:

state: The flow control state. block_size: The block size for flow control. separation_time: The separation time for flow control.

enable_faulty_speration_time(value: int) None

Enable faulty separation time with the given value.

Args:

value (int): The new separation time value.

disable_faulty_speration_time() None

Disable faulty separation time.

bind() bool

Bind the CustomCanTp for communication.

Returns:

bool: True if the binding is successful, False otherwise.

close() bool

Close the CustomCanTp connection.

Returns:

bool: True if the connection is successfully closed, False otherwise.

send(payload: list[int]) bool

Send a message over the CustomCanTp.

Args:

payload (list[int]): The payload to be sent.

Returns:

bool: True if the message is sent successfully, False otherwise.

get_queue() list[List[int]]

Get the list of received frames in the frame queue.

Returns:

list[FramePayload]: A list of received frames.

clean_up() bool

Cleans up the controller instance.

This method should be overridden to provide the specific cleanup logic. If an instance does not override it,a default message is shown to indicate that no cleanup logic is implemented.

Returns:

bool: True on success, False otherwise.

Note:

Important

This method must be overridden to implement the proper clean-up process for the respective instance/subclass.

static __new__(cls, *args, **kwargs)

Creates a new instance.

Args:

*args: The variable arguments list. **wargs: The keyword arguments list.

Returns:

ControllersBase: The newly created instance.

Note:

Note

The instance will be automatically added to the list of controllers to be cleaned up later. It guarantees that all the controller instances are followed up and cleaned up when the associate method ‘controllers_cleanup(cls)’ is called.

Important

Do not override this method in subclasses to maintain this functionality.

classmethod controllers_cleanup()

Cleans up all controller instances.

It calls clean_up() for each controller in the list. If a cleanup fails, an error is raised, but the method continues processing the remaining controllers.

Returns:
bool: True indicating that all controllers were cleaned up successfully.

Otherwise, False is returned when an error occurs during the cleanup process.