udsonip.connection
Enhanced DoIP connection for UDS communication with dynamic target address support.
- class udsonip.connection.UdsOnIpConnection(doip_client: DoIPClient, target_address: int | None = None)[source]
Bases:
BaseConnectionEnhanced DoIP connection that supports dynamic target address switching.
This connection class wraps a DoIPClient and provides the interface required by python-udsoncan while adding the ability to change the target ECU address at runtime without recreating the connection.
- Parameters:
doip_client – DoIPClient instance to use for communication
target_address – Optional target logical address. If not provided, uses the address from doip_client
Example
>>> from doipclient import DoIPClient >>> doip = DoIPClient('192.168.1.10', 0x00E0) >>> conn = UdsOnIpConnection(doip) >>> # Switch target address dynamically >>> conn.target_address = 0x00E1
- specific_send(payload: bytes)[source]
Send a UDS payload to the current target address.
- Parameters:
payload – UDS message payload to send
- specific_wait_frame(timeout: float | None = None) bytes | None[source]
Wait for and receive a UDS response frame.
- Parameters:
timeout – Maximum time to wait for response in seconds
- Returns:
Received frame data or None if timeout
- property target_address: int
Get the current target logical address.