DoipServer
- class mtf.diag_port.diag_servers.doip_server.DoipServer
Doip server
- __init__(ip: str, logical_address: int, port: int = 13400, buffer_size: int = 1024, sock_opts: dict | None = None)
Doip server constructor.
- Parameters:
ip – Doip server ip address.
logical_address – Doip server logical address.
port – Doip port number. Defaults to 13400.
buffer_size – buffer size.
sock_opts – Socket options defined in a dictionary. Keys can be either strings (option names, defaulting to SOL_SOCKET level) or tuples (level, option name). Values represent the corresponding option values.
- trigger_vehicle_announcement(ip: str, occurrence: int = 1, cycle: int = 0, port: int | None = None, further_action: bytes = b'\x00')
- This function sends the vehicle announcement message (0x0004).
It creates the DoIP message payload and sends it at every cycle interval for a specified number of occurrence times to the given (IP, port).
- Args:
ip (str): The IP address of the receiver (To whom the announcement will be sent). occurrence (int): The number of attempts to send the vehicle announcement.Defaults: 1. cycle (int): The Waiting time after each send of the vehicle announcement.Defaults: 0. port (Optional[int]): The port number if given. Defaults to None. further_action (bytes): Data bytes to be added for the packet. Defaults to b’'.
- Returns:
This method does not return a value.
- configure_socket_options(sock_opts)
Configure socket options based on the provided sock_opts dictionary.
- daemon_start()
Daemon thread that will run in the background of the main program.
- property positive_responding: bool
Getter of positive_responding attribute
- start()
Start the diagnostic server.
- stop()
Stop the diagnostic server and close the socket.
- wait_connection()
Wait for tcp connection with the diagnostic server.
- call_back(data: bytes, connection: socket, adrr: str)
- The DoipServer callback function orchestrates
the Doip communication: It handles the incoming Doip requests, processes them based on their contents and then sends appropriate responses back to the client.
- Args:
data (bytes): Doip request’s data that will be processed. connection (socket): Doip server socket. adrr (str): Doip server address.
- Returns:
This method does not return a value.