SignalController
- class mtf.network_port.signal_controller.SignalController
- __init__()
- set_signal_raw_value(channel_name: str, frame_id: int, signal_name: str, signal_value: int | list[int], update_and_send: bool = True) bool
- set_pdu_bits_value(channel_name: str, frame_id: int, pdu_name: str, start_bit: int, number_of_bits: int, bit_order: int, signal_value: int | list[int], update_and_send: bool = True) bool
Sets the value of specific bits within a (PDU) contained in a frame for a given channel.
- Args:
channel_name (str): The name of the channel. frame_id (int): The ID of the frame containing the PDU. pdu_name (str): The name of the (PDU) within the frame. start_bit (int): The starting bit index within the PDU where the value will be set. number_of_bits (int): The number of bits to be set. bit_order (int): The order of bits within the value ( 0 :’little_endian’, 1 :’big_endian’). signal_value (Union[int, List[int]]): The value(s) to set for the specified bits. This can be a single integer or a list of integers if multiple values are to be set. update_and_send (bool, optional): Whether to update and send the frame after setting the value. Defaults to True.
- Returns:
bool: True if the operation was successful, False otherwise.
- set_signal_physical_value(channel_name: str, frame_id: int, signal_name: str, signal_value: float, update_and_send: bool = True) bool
- get_signal_last_value(channel_name: str, frame_id: int, signal_name: str) int | list[int] | float
- get_signal_last_physical_value(channel_name: str, frame_id: int, signal_name: str) int | list[int] | float
- get_signal_payload_value(channel_name: str, frame_id: int, signal_name: str, payload: list[int], is_physical: bool) int | list[int] | float | str
Retrieves the value of a signal from the given payload of a frame.
- === Arguments Description ===
channel_name (str): The name of the channel. frame_id (int): The ID of the frame. signal_name (str): The name of the signal. payload (list[int]): The payload of the frame from which to extract the signal value. is_physical (bool): if True return physical value otherwise raw value.
- === Returns ===
Union[int, list[int], float, string]: The value of the signal.
- === Example ===
controller = SignalController() res = controller.get_signal_payload_value(“channel_name”, 1, “signal_name”, [0,1,0,3,1,0,0,0], True) assert res == 3
- last_signal_value_retrieved(channel_name: str, frame_id: int, signal_name: str) bool
- start_transmission_frame(channel_name: str, frame_id: int) bool
- stop_transmission_frame(channel_name: str, frame_id: int) bool
- get_signal_path(channel_name: str, frame_id: int, signal_name: str) str
- is_from_dynamic_pdu_signal(channel_name: str, frame_id: int, signal_name: str) bool
- get_signal_paths(bus_name: str, signal_name: str) list[str]