Transports

UDSClient accepts a Transport, which exchanges complete protocol data units independently of the underlying protocol. Software IsoTP, DoIP, and J2534NativeIsoTP share this interface. DoIP communicates over IPv4/IPv6 sockets without a CAN adapter.

Software ISO-TP lives in automotive.transports.isotp. The native J2534 implementation lives in automotive.adapters.j2534 and is documented under adapters.

Asynchronous API

Transports exchanging complete diagnostic protocol data units.

class automotive.transports.Transport(native: R)[source]

A message transport usable by UDS, independent of the underlying protocol.

Concrete transports handle framing, addressing, and connection setup. Closing a transport invalidates its receivers and diagnostic clients.

async send(data: bytes | bytearray | memoryview) → None[source]

Transmit one complete PDU using the transport’s framing and limits.

Parameters:

data – Bytes, bytearray, or contiguous byte-oriented memoryview.

Transport failures raise the corresponding protocol or connection error. A transmission deadline raises TimeoutError.

recv() → Receiver[bytes][source]

Subscribe immediately to complete received PDUs as bytes.

Returns:

An async iterator with aclose and async context management.

Subscribe before sending. Closing this receiver releases its subscription. A receive deadline raises TimeoutError; another anext may continue.

async aclose() → None

Release hardware and wake pending operations; repeated calls are safe.

property closed: bool

Whether this resource or its owning parent has been closed.

Synchronous API

automotive.sync.transports.Transport provides the matching blocking interface for synchronous ISO-TP, native J2534, and diagnostic clients.

class automotive.sync.transports.Transport(resource: R)[source]

A blocking message transport usable by UDS, independent of its protocol.

Concrete transports handle framing, addressing, and connection setup. Closing a transport invalidates its receivers and diagnostic clients.

send(data: bytes | bytearray | memoryview) → None[source]

Transmit one complete PDU, blocking until the transport completes it.

Parameters:

data – Bytes, bytearray, or contiguous byte-oriented memoryview.

Transport failures raise the corresponding protocol or connection error. A transmission deadline raises TimeoutError.

recv() → Receiver[bytes][source]

Subscribe immediately to complete received PDUs as bytes.

Returns:

A blocking iterator supporting with and close(). Subscribe before sending. A receive deadline raises TimeoutError; next() can resume.

close() → None

Release the resource and wake pending operations; idempotent.

property closed: bool

Whether this resource or its owning parent has been closed.