Someip Controller Module

SomeipListener Module.

class mtf.network_port.someip_controller.SomeipListener
__init__(channel_name: str = 'ETH-SOMEIP', protocol: ~mtf.proto_common.EthProtocolType | ~mtf.libs.mtf_pybinder.mtf_eth_filter | ~mtf.libs.mtf_pybinder.mtf_someip_filter = <mtf_eth_protocol_type.SOME_IP: 2251799813685248>) None

Creates a new instance using the given parameters.

Args:

bus_name (str): The name of the bus to listen on.

Returns:

BusListener: The newly created instance.

configure(someip_filter: ~mtf.libs.mtf_pybinder.mtf_someip_filter = None, listener_type: ~mtf.libs.mtf_pybinder.SomeIpListenerType = <SomeIpListenerType.GetSeparateFrames: 2>) None
start_listening(keep_cache: bool = False, silent_mode: bool = True) bool

Starts listening on a bus and can be configured to operate in silent mode or to reset cached data before beginning to listen

Args:

keep_cache (bool) silent_mode (bool): Specify whether the listening should be done in silent mode or not

Return:

bool

stop_listening(flush_event_history: bool = True) bool

Stops listening on the bus and optionally handles the remaining buffered events.

Args:
flush_event_history (bool):

If True (default), full event details are stored into the queues If False, only minimal information is stored from the remaining events

Returns:

bool: True if the listener stopped successfully, False otherwise.

reset() None

Resets the state of the bus listener by clearing its history and emptying the event queue.

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.

adapt_queue_elements() Queue[BaseEvent]

ensure the object.timestamp, object.payload

clean_up()

This method cleans up resources used by the listener by stopping any ongoing operations and resetting the listener’s internal state to ensure it is in a clean and ready state for future use.

Returns:

bool: Returns True if the cleanup is successfully done. False if an exception occurs.

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.

get_queue() list[dict[str, Any]]

Reset the internal state of an instance of the EthBusListener class

get_timestamp_queue() list[int]

Retrieve the private attribute _timestamp_queue Return:

list[int]

register_callback(callback_fnc: Callable[[IEthernetProtocol], None])
Parameters:

callback_fnc – callback function with parameter of type MessageEthernet

Setting a callback
# ...
from andisdk import MessageEthernet
# ...

def eth_listener_callback(msg: MessageEthernet):
    # do things

# ... creating listener
# register our callback
listener.register_callback(eth_listener_callback)

Warning

The callback function should be lightweight without logs. Otherwise, it will reduce the performance dramatically. The object that is passed to callback functions is mutable. So the user must be careful. In case of silent mode, the callback functions will be invoked only when getting the queue.

set_queue_size(max_size: int)

This call of set queue size will clear the queue and resize it better to call it at the beginning : before start listening if max_size <= 0 the queue size is infinite

unregister_callback(callback_fnc: Callable[[IEthernetProtocol], None])
Parameters:

callback_fnc – callback function with parameter of type MessageEthernet

Remove a callback
# ...
from andisdk import MessageEthernet
# ...

def eth_listener_callback(msg: MessageEthernet):
    # do things

# ... creating listener
# ... do work
# unregister our callback
listener.unregister_callback(eth_listener_callback)
mtf.network_port.someip_controller.create_someip_filter_from_andi_dict(someip_filter: dict) mtf_someip_filter