NmManager
- class mtf.network_port.nm_manager.NmManager
Network Management manager
- __init__()
- start_nm_controller(bus_name: str, node_id: int = 16, bus_type: BusType = BusType.CAN, cycle=0.01, frame_id: int = 0)
Start sending cyclically the NM frame.
- Args:
bus_name (str): bus name node_id (int, optional): node identifier. Defaults to 0x10. bus_type (BusType, optional): bus type. It could be CAN, Ethernet, CANFD. Defaults to BusType.CAN. cycle (float, optional): sending cycle time. Defaults to 0.01. frame_id (int, optional): NM frame identifier. Defaults to 0x510.
- Returns:
Boolean: True if the start cyclic send was started, else False.
- stop_nm_controller(bus_name: str)
Stop sending the NM frame.
- Args:
bus_name (str): the bus name
- Returns:
Boolean: True if the send was stopped properly.Else False
- stop_all()
Stop all the started NM controllers.
- set_functional_pn(bus_name: str, payload: List[int])
Set Functional Partial Network
- Args:
bus_name (str): bus name. payload (List[int]): signal value
- Returns:
Boolean: True if signal value was set, else False
- clean_up()
Clear all the created NM controllers.
- Returns:
Boolean: True if cleanup done, else False
- 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.