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 with option name as key and value as value.

trigger_vehicle_announcement(ip: str, occurrence: int = 1, cycle: int = 0, port: int | None = None, further_action: bytes = b'\x00')

Send the vehicle announcement occurrence times every cycle.

Parameters:
  • ip – The IP address of the receiver (To whom the announcement will be sent).

  • occurrence – The number of attempts to send the vehicle announcement. Defaults to 1.

  • cycle – The Waiting time after each send of the vehicle announcement. Defaults to 0.

  • port – The port number if given. Defaults to None.

  • further_action – Data bytes to be added for the packet. Defaults to b’'.

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. Orchestrate the doip communication.

Parameters:
  • data – Doip request’s data.

  • connection – Doip server socket.

  • adrr – Doip server address.