Listener Base Module
- class mtf.network_port.listeners.listener_base.BaseEvent
BaseEvent(timestamp, payload)
- timestamp: int
Alias for field number 0
- payload: Any
Alias for field number 1
- static __new__(_cls, timestamp: int, payload: Any)
Create new instance of BaseEvent(timestamp, payload)
- count(value, /)
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
- class mtf.network_port.listeners.listener_base.ListenerBase
Base class for mtf listeners
- __init__(bus_name: str, *args, **kwargs)
- abstract start_listening()
- abstract stop_listening()
- get_queue() Queue
Get the queue
- reset()
cleanup the queue
- static __new__(cls, *args, **kwargs)
Initializes a new instance of the ControllerBase.
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.
- Note:
Do not override this method in subclasses to maintain this functionality.
- Args:
*args: Suitable arguments passed to the constructor of the ControllerBase class. **kwargs: keywords passed to the constructor of the ControllerBase class.
- Returns:
instance(ControllerBase): The new instance of the class that has been created.
- clean_up() bool
Clean up all controller instances. This method should be overridden to precise the specific cleanup logic. If an instance does not override it, a default message will appear to inform that there are no cleanup logic is implemented.
- Return:
bool: True when the cleanup was successful, otherwise False if cleanup failed. By default, it returns True, yet this method should be overridden to present the actual cleanup status.
- classmethod controllers_cleanup()
Cleans up all controller instances.
It Calls the clean_up() method for each instance, since it iterates through the list of controllers to realize any needed cleanup which can fail so an error will be raised. Then, the remaining instances will continue processing.
- Returns:
bool: True indicating that all the controllers are successfully cleaned up, otherwise False when an error occurred during the operation of the cleanup.