LinSlaveSimulation

class mtf.network_port.lin_slave_simulation.LinSlaveSimulation

class to control lin slave response for a specific SID .

__init__(channel_name: str, nad: int)
send_raw_response(payload: List)

Transmit LIN payload

Parameters:

payload – slave response payload

Returns boolean:

True if transmission done, else False

stop()

Clean up Lin slave simulation controllers.

get_master_request_nad_queue() dict

return all received lin requests for given nad :type sid: service id :return: list[LinRequest] :rtype: list[LinRequest]

get_master_service_request_queue(sid: int) List[LinRequest]

return received lin requests for given nad :param sid: service identifier :type sid: int :return: LinRequest :rtype: LinRequest

reset_listener(sid: int | None = None)

reset received lin requests depending on the parameters cass1:sid=None reset everything case2:sid!=None reset the queue for specific sid only :param sid: service identifier :type sid:int :return: Nothing :rtype:

set_slave_response(sid: int, nrc: int = 0, data: [] = None)

update the reponse to be send by the simulation once the request for the service with id sid is received :param sid: service id :type sid: int :param nrc: negative response code :type nrc: int :param data: slave response data :type data: list[int] :return: nothing :rtype:

monitor_happened_master_request(sid: int, supplier_id: [<class 'int'>], function_id: [<class 'int'>], timeout: int) bool

Checks monitor happened for master request :param sid: :type sid: :param supplier_id: :type list[int]: :param function_id: :type list[int]: :param timeout: :type int: :return:bool :rtype:

monitor_always_master_request(sid: int, supplier_id: [<class 'int'>], function_id: [<class 'int'>], timeout: int) bool

Checks monitor always for master request :param sid: :type sid: :param supplier_id: :type list[int]: :param function_id: :type list[int]: :param timeout: :type int: :return:bool :rtype:

check_group(max_cycle, timeout, msg_added_to_group=False)

Check master request group cyclicity.

Args:

max_cycle (int): max cycle value timeout (int): listening timeout msg_added_to_group (bool, optional): _description_. Defaults to False.

Returns:

Boolean:

map_response_with_request(request_map: [[<class 'int'>]], response_map: [[<class 'int'>]])

Send slave response based on received master request data, using the user slave data.

Parameters:
  • request_map (list[list[int]]) – List of master requests data. each master request is a list of integers

  • response_map (list[list[int]]) – List of slave response data. each slave response is a list of integers

:return:bool :rtype:

clean_up()

Clean up linslave simulation and reset all listeners

Returns:

Boolean: True if cleanup done.Else False

add_msg_to_group(payload)

Add the message to the group

Args:

payload (list[int]): message payload