Enhanced UDS-on-IP integration library providing seamless multi-ECU support
Project description
python-udsonip
Enhanced UDS-on-IP Integration Library
Note: Install via
pip install udsonip(package name without thepython-prefix)
udsonip is a high-level Python library that seamlessly integrates python-doipclient and python-udsoncan to provide enhanced multi-ECU support, improved ergonomics, and advanced features for automotive diagnostics over DoIP (Diagnostics over Internet Protocol).
๐ Documentation:
- For Users: This README (installation, usage, examples)
- For Contributors: See CONTRIBUTING.md (setup, testing, contribution guidelines)
- Project Status: See DEVELOPMENT.md (features, roadmap, architecture)
Features
- ๐ฏ Dynamic Target Address Support - Runtime switching between ECU addresses
- ๐ Multi-ECU Management - Single connection managing multiple ECUs with context managers
- ๐ Auto-Discovery - Automatic ECU enumeration and discovery
- ๐ก Enhanced Session Management - Per-ECU session tracking and persistence
- ๐ ๏ธ Simplified API - Less boilerplate, sensible defaults
Installation
pip install udsonip
Quick Start
Single ECU Communication
from udsonip import UdsOnIpClient
# Simple single-ECU client
client = UdsOnIpClient('192.168.1.10', 0x00E0)
response = client.read_data_by_identifier(0xF190) # Read VIN
print(f"VIN: {response.data.decode()}")
client.close()
Multi-ECU Communication
from udsonip import DoIPManager
# Multi-ECU manager
manager = DoIPManager('192.168.1.10')
manager.add_ecu('engine', 0x00E0)
manager.add_ecu('transmission', 0x00E1)
# Switch between ECUs seamlessly
with manager.ecu('engine') as ecu:
vin = ecu.read_data_by_identifier(0xF190)
with manager.ecu('transmission') as ecu:
status = ecu.read_data_by_identifier(0x1234)
Auto-Discovery
from udsonip import discover_ecus
# Discover all ECUs on the network
ecus = discover_ecus(timeout=5.0)
for ecu in ecus:
print(f"Found ECU: {ecu.ip} @ {ecu.logical_address:#x}")
# Connect to discovered ECU
client = ecus[0].connect()
Advanced Usage - Dynamic Target Switching
from udsonip import UdsOnIpClient
client = UdsOnIpClient(
ecu_ip='192.168.1.10',
ecu_address=0x00E0,
auto_reconnect=True,
keep_alive=True,
)
# Dynamic target address switching
client.target_address = 0x00E1
response = client.tester_present()
client.target_address = 0x00E2
response = client.read_data_by_identifier(0xF190)
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Your Application โ
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโ
โ udsonip Layer โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ
โ โ UdsOnIpClientโ โ MultiECU Mgr โโ
โ โโโโโโโโฌโโโโโโโโ โโโโโโโโฌโโโโโโโโโ
โ โ โ โ
โ โโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโ
โ โ UdsOnIpConnection โโ
โ โโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ python-udsoncan โ โdoipclient โ
โ (UDS Protocol) โ โ(DoIP Trans) โ
โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
Key Components
- UdsOnIpConnection - Enhanced connector with dynamic address support
- UdsOnIpClient - Unified client wrapping both libraries
- DoIPManager - Multi-ECU manager with context switching
- discover_ecus() - ECU discovery utilities
Why udsonip?
Before (using libraries separately):
from doipclient import DoIPClient
from udsoncan.client import Client
from udsoncan.connections import BaseConnection
# Manual setup required - 20+ lines of boilerplate
doip_client = DoIPClient('192.168.1.10', 0x00E0)
doip_client.connect()
class DoIPConnection(BaseConnection):
def __init__(self, doip_client):
self._doip = doip_client
def send(self, data):
self._doip.send_diagnostic(data)
def wait_frame(self, timeout=None):
return self._doip.receive_diagnostic(timeout)
connection = DoIPConnection(doip_client)
uds_client = Client(connection)
# Finally use UDS client
response = uds_client.read_data_by_identifier(0xF190)
After (using udsonip):
from udsonip import UdsOnIpClient
# Just 2 lines!
client = UdsOnIpClient('192.168.1.10', 0x00E0)
response = client.read_data_by_identifier(0xF190)
Result: 90% less code, 100% more readable! ๐
Requirements
- Python >= 3.7
- python-doipclient >= 1.1.7
- python-udsoncan >= 1.21
API Reference
UdsOnIpClient
Main client for single ECU communication.
client = UdsOnIpClient(
ecu_ip='192.168.1.10',
ecu_address=0x00E0,
client_ip=None, # Auto-detect
auto_reconnect=False,
keep_alive=False,
)
Key Methods:
read_data_by_identifier(did)- Read data by identifierwrite_data_by_identifier(did, data)- Write datatester_present()- Send tester presentdiagnostic_session_control(session)- Change diagnostic sessionecu_reset(reset_type)- Reset ECUclose()- Close connection
DoIPManager
Manager for multiple ECUs on the same gateway.
manager = DoIPManager('192.168.1.10')
manager.add_ecu('engine', 0x00E0)
manager.add_ecu('transmission', 0x00E1)
with manager.ecu('engine') as ecu:
# Use ecu like UdsOnIpClient
vin = ecu.read_data_by_identifier(0xF190)
Discovery Functions
from udsonip import discover_ecus, ECUInfo
# Discover all ECUs
ecus = discover_ecus(interface=None, timeout=5.0)
# Connect to discovered ECU
client = ecus[0].connect()
Learning Resources
- DoIP Standard: ISO 13400 (Diagnostics over Internet Protocol)
- UDS Standard: ISO 14229 (Unified Diagnostic Services)
- python-doipclient: https://github.com/jacobschaer/python-doipclient
- python-udsoncan: https://github.com/pylessard/python-udsoncan
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for:
- Development environment setup
- Running tests
- Code style guidelines
- Contribution workflow
License
MIT License - see LICENSE file for details.
Support & Community
- Issues: https://github.com/sirius-cc-wu/python-udsonip/issues
- Documentation: https://python-udsonip.readthedocs.io
- Examples: See
examples/directory in the repository
Acknowledgments
Built on top of:
- python-doipclient by Jacob Schaer
- python-udsoncan by Pier-Yves Lessard
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file udsonip-0.4.0.tar.gz.
File metadata
- Download URL: udsonip-0.4.0.tar.gz
- Upload date:
- Size: 30.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08dbee31ba6ee24926a0adb5fd15bdcc58149efc025303ff833c142dbc785471
|
|
| MD5 |
48cfcc12c1cc30ab86856c20f7b9630e
|
|
| BLAKE2b-256 |
41a371cca8adb69933e7ce350dd05cf05113b9275a4f85b07b76e07fda8ed1b1
|
Provenance
The following attestation bundles were made for udsonip-0.4.0.tar.gz:
Publisher:
publish.yml on sirius-cc-wu/python-udsonip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
udsonip-0.4.0.tar.gz -
Subject digest:
08dbee31ba6ee24926a0adb5fd15bdcc58149efc025303ff833c142dbc785471 - Sigstore transparency entry: 829211797
- Sigstore integration time:
-
Permalink:
sirius-cc-wu/python-udsonip@215d1c88cec9e20e2b48c03ef1a2cb9206c10436 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sirius-cc-wu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@215d1c88cec9e20e2b48c03ef1a2cb9206c10436 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file udsonip-0.4.0-py3-none-any.whl.
File metadata
- Download URL: udsonip-0.4.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75b63aedfa5a6ca2c20abd22c7ea8a98824ba51afeda5965caaa7080640b0c46
|
|
| MD5 |
3cf1169a2fd2a58aa6c8233f81743fb9
|
|
| BLAKE2b-256 |
33b326ef1f992aae82f333c02fa0baf37cbda6993dfcc05d877a3f5679c0dcc9
|
Provenance
The following attestation bundles were made for udsonip-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on sirius-cc-wu/python-udsonip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
udsonip-0.4.0-py3-none-any.whl -
Subject digest:
75b63aedfa5a6ca2c20abd22c7ea8a98824ba51afeda5965caaa7080640b0c46 - Sigstore transparency entry: 829211808
- Sigstore integration time:
-
Permalink:
sirius-cc-wu/python-udsonip@215d1c88cec9e20e2b48c03ef1a2cb9206c10436 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sirius-cc-wu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@215d1c88cec9e20e2b48c03ef1a2cb9206c10436 -
Trigger Event:
workflow_dispatch
-
Statement type: