Signal Module
- class mtf.network_port.signals.signal.SigListener
- __init__(channel_name: str, frame_id: int, pdu_name: str, signal_name: str)
- start_listening(on_change: bool = False)
Starts listening for the signal.
- Args:
- on_change (bool, optional): A flag indicating if the listener should only trigger on signal changes.
Defaults to False.
- Returns:
bool: True if the listener was started successfully, False otherwise.
- stop_listening() bool
Stops listening for the signal.
- Returns:
bool: True if the listener was stopped successfully, False otherwise.
- get_signal_listener_queue() list
Retrieves the list of received signals in the listener.
- Returns:
list: A list of dictionaries containing the timestamp and payload of the received signals.
- reset_signal_listener_queue() None
Resets the listener queue, clearing the history of received signals.
- static __new__(cls, *args, **kwargs)
Initialize a new instance of the ControllerBase.
The instance will be automatically added to the list of controllers.
- clean_up() bool
- classmethod controllers_cleanup()
Clean up all controller instances.
Calls the clean_up() method for each instance.
- get_queue() Queue
Get the queue
- reset()
cleanup the queue
- class mtf.network_port.signals.signal.Signal
- static __new__(cls, channel_name: str, frame_id: str, pdu_name: str, signal_name: str)
Overrides the __new__ method to ensure only one instance of Signal class is created for each tuple (channel_name, frame_id, pdu_name, signal_name).
- Args:
channel_name (str): The name of the channel. frame_id (str): The ID of the frame. pdu_name (str): The name of the pdu. signal_name (str): The name of the signal.
- Returns:
Signal: The signal instance associated with the tuple (channel_name, frame_id, pdu_name, signal_name).
- __init__(channel_name: str, frame_id: str, pdu_name: str, signal_name: str)
Initializes a Signal instance with the given tuple (channel_name, frame_id, pdu_name, signal_name).
- Args:
channel_name (str): The name of the channel. frame_id (str): The ID of the frame. pdu_name (str): The name of the pdu. signal_name (str): The name of the signal.
- property channel_name: str
Retrieves the name of the channel.
- Returns:
str: The name of the channel.
- property frame_id: str
Retrieves the ID of the frame.
- Returns:
str: The ID of the frame.
- property pdu_name: str
Retrieves the name of the pdu.
- Returns:
str: The name of the pdu.
- property signal_name: str
Retrieves the name of the signal.
- Returns:
str: The name of the signal.
- property listener
Retrieves a SignalListener instance associated with the signal.
- Returns:
SignalListener: The SignalListener instance associated with the signal.
- property frame_id_int
Retrieves the integer representation of the frame ID.
- Returns:
int: The integer representation of the frame ID.
- set_signal_raw_value(signal_value: int | list[int], update_and_send: bool = True) bool
Sets the raw value of the signal with the given value.
- Args:
signal_value (Union[int, list[int]]): The raw value of the signal. update_and_send (bool, optional): A flag indicating if the update and send operation should be performed.
Defaults to True.
- Returns:
bool: True if the raw value was set successfully, False otherwise.
- set_signal_physical_value(signal_value: float, update_and_send: bool = True) bool
Sets the physical value of the signal with the given value.
- Args:
signal_value (float): The physical value of the signal. update_and_send (bool, optional): A flag indicating if the update and send operation should be performed.
Defaults to True.
- Returns:
bool: True if the physical value was set successfully, False otherwise.
- get_signal_last_value() int | list[int]
Retrieves the last value of the signal.
- Returns:
Union[int, list[int]]: The last value of the signal.
- get_signal_last_physical_value() int | list[int]
Retrieves the last physical value of the signal.
- Returns:
Union[int, list[int]]: The last physical value of the signal.
- last_signal_value_retrieved() bool
Checks if the last value of the signal has been retrieved.
- Returns:
bool: True if the last value has been retrieved, False otherwise.
- get_signal_path() str
Retrieves the path of the signal.
- Returns:
str: The path of the signal.
- is_from_dynamic_pdu_signal() bool
Checks if the signal is from a dynamic PDU.
- Returns:
bool: True if the signal is from a dynamic PDU, False otherwise.
- classmethod clear_registered_signals()
Clears the instances dictionary of registered signals.