# pylessard/python-udsoncan architecture

> Architecture diagram of the GitHub repository pylessard/python-udsoncan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pylessard/python-udsoncan
- Repository: https://github.com/pylessard/python-udsoncan

## Overview

python-udsoncan is a Python implementation of the automotive UDS diagnostic protocol. A developer uses Client with a configured connection to issue diagnostic operations; Client builds service requests, exchanges them with an ECU, and interprets responses. The service modules cover session/security, data access, fault diagnostics, memory transfer, and ECU control. Common modules provide DID codecs and diagnostic data types. The excerpts establish the Client and transport roles; service-family links reflect the documented module layout, not inspected call sites.

Main entry points: [`udsoncan/client.py`](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/client.py) (Client), [`udsoncan/BaseService.py`](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/BaseService.py) (Service framework), [`udsoncan/services/ReadDTCInformation.py`](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/ReadDTCInformation.py) (DTC diagnostics), [`udsoncan/services/DiagnosticSessionControl.py`](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/DiagnosticSessionControl.py) (Session and access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Diagnostic API"]
  node_client["Client<br/>[client.py]"]
  node_config["Client config<br/>[configs.py]"]
  node_session["Session and access"]
  node_authentication["Authentication<br/>[Authentication.py]"]
  node_dataaccess["Data access"]
  node_dtcservice["DTC diagnostics"]
  node_memory["Memory transfer<br/>[RequestDownload.py]"]
  node_control["ECU control<br/>[RoutineControl.py]"]
end

subgraph group_protocol["UDS Protocol"]
  node_request["Request encoding<br/>[Request.py]"]
  node_response["Response decoding<br/>[Response.py]"]
  node_base["Service framework<br/>[BaseService.py]"]
  node_codes["Response codes<br/>[ResponseCode.py]"]
end

subgraph group_domain["Diagnostic Data"]
  node_did["DID codecs<br/>[dids.py]"]
  node_dtc["DTC model<br/>[dtc.py]"]
  node_common["Diagnostic types"]
end

subgraph group_transport["Transport"]
  node_connection["Connection adapters<br/>[connections.py]"]
end

node_developer(("Diagnostic user"))
node_ecu(("UDS server"))

node_developer -->|"calls"| node_client
node_client -->|"uses"| node_config
node_client -->|"dispatches"| node_session
node_client -->|"dispatches"| node_authentication
node_client -->|"dispatches"| node_dataaccess
node_client -->|"dispatches"| node_dtcservice
node_client -->|"dispatches"| node_memory
node_client -->|"dispatches"| node_control
node_client -->|"builds"| node_request
node_client -->|"sends and receives"| node_connection
node_connection -->|"transports payloads"| node_ecu
node_client -->|"decodes"| node_response
node_session -->|"implements"| node_base
node_authentication -->|"implements"| node_base
node_dataaccess -->|"implements"| node_base
node_dtcservice -->|"implements"| node_base
node_memory -->|"implements"| node_base
node_control -->|"implements"| node_base
node_base -->|"checks codes"| node_codes
node_client -->|"uses codecs"| node_did
node_dtcservice -->|"models DTCs"| node_dtc
node_client -->|"uses types"| node_common

click node_client "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/client.py"
click node_config "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/configs.py"
click node_session "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/DiagnosticSessionControl.py"
click node_authentication "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/Authentication.py"
click node_dataaccess "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/ReadDataByIdentifier.py"
click node_dtcservice "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/ReadDTCInformation.py"
click node_memory "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/RequestDownload.py"
click node_control "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/RoutineControl.py"
click node_request "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/Request.py"
click node_response "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/Response.py"
click node_base "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/BaseService.py"
click node_codes "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/ResponseCode.py"
click node_did "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/common/dids.py"
click node_dtc "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/common/dtc.py"
click node_common "https://github.com/pylessard/python-udsoncan/tree/master/udsoncan/common"
click node_connection "https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/connections.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_config,node_session,node_authentication,node_dataaccess,node_dtcservice,node_memory,node_control,node_developer toneBlue
class node_request,node_response,node_base,node_codes toneAmber
class node_did,node_dtc,node_common,node_ecu toneMint
class node_connection toneRose
```

## Components

### Diagnostic API

- [Client](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/client.py): `udsoncan/client.py`
- [Client config](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/configs.py): `udsoncan/configs.py`
- [Session and access](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/DiagnosticSessionControl.py): `udsoncan/services/DiagnosticSessionControl.py`
- [Authentication](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/Authentication.py): `udsoncan/services/Authentication.py`
- [Data access](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/ReadDataByIdentifier.py): `udsoncan/services/ReadDataByIdentifier.py`
- [DTC diagnostics](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/ReadDTCInformation.py): `udsoncan/services/ReadDTCInformation.py`
- [Memory transfer](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/RequestDownload.py): `udsoncan/services/RequestDownload.py`
- [ECU control](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/services/RoutineControl.py): `udsoncan/services/RoutineControl.py`

### UDS Protocol

- [Request encoding](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/Request.py): `udsoncan/Request.py`
- [Response decoding](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/Response.py): `udsoncan/Response.py`
- [Service framework](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/BaseService.py): `udsoncan/BaseService.py`
- [Response codes](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/ResponseCode.py): `udsoncan/ResponseCode.py`

### Diagnostic Data

- [DID codecs](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/common/dids.py): `udsoncan/common/dids.py`
- [DTC model](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/common/dtc.py): `udsoncan/common/dtc.py`
- [Diagnostic types](https://github.com/pylessard/python-udsoncan/tree/master/udsoncan/common): `udsoncan/common`

### Transport

- [Connection adapters](https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/connections.py): `udsoncan/connections.py`

### Other components

- **Diagnostic user**
- **UDS server**

## Connections

- Diagnostic user → Client: calls
- Client → Client config: uses
- Client → Session and access: dispatches
- Client → Authentication: dispatches
- Client → Data access: dispatches
- Client → DTC diagnostics: dispatches
- Client → Memory transfer: dispatches
- Client → ECU control: dispatches
- Client → Request encoding: builds
- Client → Connection adapters: sends and receives
- Connection adapters → UDS server: transports payloads
- Client → Response decoding: decodes
- Session and access → Service framework: implements
- Authentication → Service framework: implements
- Data access → Service framework: implements
- DTC diagnostics → Service framework: implements
- Memory transfer → Service framework: implements
- ECU control → Service framework: implements
- Service framework → Response codes: checks codes
- Client → DID codecs: uses codecs
- DTC diagnostics → DTC model: models DTCs
- Client → Diagnostic types: uses types
