Diag Server Module
- class mtf.diag_port.diag_servers.diag_server.DiagRequest
- Diagnostic response generator Class. - __init__(payload: bytes)
- DiagRequest constructor. - Parameters:
- payload – response payload. 
 
 - generate_negative_response(nrc: int = 17, data: bytes = b'') bytes
- Generate a negative diagnostic response. - Parameters:
- nrc – Negative Response Codes. Defaults to 0x11. 
- data – response data. 
 
- Returns:
- Negative response. 
 
 - generate_positive_response(data: bytes = b'') bytes
- Generate a positive diagnostic response. - Parameters:
- data – positive response data. 
- Returns:
- positive response. 
 
 
- class mtf.diag_port.diag_servers.diag_server.DiagServer
- Create a diagnostic server by opening a tcp socket with the given ip address and port and wait for the connection establishment. - __init__(ip: str, port: int, buffer_size: int = 1024, sock_opts: dict | None = None)
 - property positive_responding: bool
- Getter of positive_responding attribute 
 - daemon_start()
- Daemon thread that will run in the background of the main program. 
 - 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, connection, addr)
- TCP connection callback function. - Parameters:
- data – bytes object representing the data received. 
- connection – tcp socket. 
- addr – server ip address. 
 
 
 - configure_socket_options(sock_opts)
- Configure socket options based on the provided sock_opts dictionary.