FlexrayBusListener

class mtf.network_port.bus_listener.FlexrayBusListener
__init__(bus_name: str)
get_queue() Queue[FlexrayBusEvent]

Get the queue

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

callback_fnc – callback function with parameter of type FlexrayBusEvent

Setting a callback
# ...
from mtf.mtf_types import FlexrayBusEvent
# ...

def my_callback(msg: FlexrayBusEvent):
    # do things

# ... creating listener 
# register our callback
listener.register_callback(my_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.

unregister_callback(callback_fnc)
Parameters:

callback_fnc – callback function with parameter of type FlexrayBusEvent, which has been registered

:Example def flexray_bus_listener_callabck(data_frame :FlexrayBusEvent)

callback_(data_frame: BusEvent)
static __new__(cls, *args, **kwargs)

Initialize a new instance of the ControllerBase.

The instance will be automatically added to the list of controllers.

adapt_queue_elements() Queue[BaseEvent]

ensure the object.timestamp, object.payload

clean_up()
classmethod controllers_cleanup()

Clean up all controller instances.

Calls the clean_up() method for each instance.

reset()

cleanup the queue

start_listening(silent_mode: bool = False) bool
stop_listening() bool