Synchronous API

Synchronous CAN, ISO-TP, and UDS with the same Rust implementation.

Import blocking classes from automotive.sync.adapters, automotive.sync.transports.isotp, and automotive.sync.protocols.uds. Constructors open adapters immediately. Use ordinary method calls and for loops. Context managers and explicit close() remain available. Configuration objects, CAN frames, enum values, result types, and exceptions are shared with the async API. One background event loop runs the async façade and shuts down at process exit. Hardware and subscriptions are released when their last owner is dropped; explicit close() and with blocks support deterministic cleanup.

These calls block the calling thread. Use automotive.adapters, automotive.transports.isotp, and automotive.protocols.uds in asyncio programs.

Configurations, CAN frames, UDS enums, result types, and exceptions are the same objects documented in the other API pages. Both APIs run the same Rust protocol implementation. Import paths mirror the async hierarchy:

from automotive.sync.adapters import SocketCanAdapter
from automotive.sync.protocols.uds import DataIdentifier, UDSClient
from automotive.sync.transports.isotp import IsoTP

The synchronous reference appears alongside the async API in each package section:

Package

Reference

automotive.sync.can

CAN frames and identifiers

automotive.sync.can.bitrate

Bitrate configuration

automotive.sync.adapters

Adapters

automotive.sync.adapters.j2534

Native J2534 ISO-TP

automotive.sync.transports

Transport interface

automotive.sync.transports.isotp

ISO-TP

automotive.sync.protocols.uds

UDS

automotive.sync.errors

Exceptions

Receive subscriptions

class automotive.sync._base.Receiver(receiver: Receiver[T])[source]

An eager receive subscription supporting ordinary iteration and with.

Create the subscription before sending. Each next() blocks until a value, a protocol timeout, or closure. A timeout raises TimeoutError and leaves the subscription usable. Closing the receiver or its owner ends iteration. Dropping the receiver releases the subscription. A with block or close() supports deterministic cleanup.

close() → None[source]

Wake a pending receive and release this subscription; idempotent.