Doip Server Module
- class mtf.diag_port.diag_servers.doip_server.DoipRequest
- The Doip responses generator. - __init__(payload: bytes, logical_add: bytes | None = None)
- DoipRequest constructor. - Parameters:
- payload – Doip response payload. 
- logical_add – server/ target logical address. 
 
 
 - generate_negative_response(nrc: int = 17, data: bytes = b'') bytes
- Generate a negative response on a Doip request. - Parameters:
- nrc – Negative response Code. Defaults to 0x11. 
- data – response data. 
 
- Returns:
- doip negative response composed of the Doip header and the uds packet. 
 
 - generate_ack()
- Generate the tcp acknowledgement. - Returns:
- The acknowledgement packet 
 
 - generate_routing_activation_response() bytes
- generate the routing activation response. - Returns:
- The routing activation response. 
 
 - generate_positive_response(data: bytes = b'') bytes
- Generate a positive response on a Doip request. - Parameters:
- data – response data. 
- Returns:
- The doip positive response composed of the Doip header and the uds packet. 
 
 
- 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.