Skip to main content

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 the python- 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 DoIPMultiECUClient

# Multi-ECU manager
manager = DoIPMultiECUClient('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
  • DoIPMultiECUClient - 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 identifier
  • write_data_by_identifier(did, data) - Write data
  • tester_present() - Send tester present
  • diagnostic_session_control(session) - Change diagnostic session
  • ecu_reset(reset_type) - Reset ECU
  • close() - Close connection

DoIPMultiECUClient

Manager for multiple ECUs on the same gateway.

manager = DoIPMultiECUClient('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

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

Acknowledgments

Built on top of:

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

udsonip-0.2.1.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

udsonip-0.2.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file udsonip-0.2.1.tar.gz.

File metadata

  • Download URL: udsonip-0.2.1.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for udsonip-0.2.1.tar.gz
Algorithm Hash digest
SHA256 57a941e2c095c907b7e46575cf5cbda95e6dfad1c5cbef2169efd7418d92799d
MD5 ea58f4b511752418825b3b4a820cc872
BLAKE2b-256 8eb24bb35a7c2f8a49ac3d7bd49e979931127ac069696f8a83a955bd86325dc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for udsonip-0.2.1.tar.gz:

Publisher: publish.yml on sirius-cc-wu/python-udsonip

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file udsonip-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: udsonip-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for udsonip-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 12269f0998a878b25942d8f3139bf92f2e9ea246bc88b95d9ca4494a792108fb
MD5 32ec498de588bed567658c0ef9ae38ac
BLAKE2b-256 6659c31dc91e6585081067ec27d1f7f929cbb54aca546b2772ecab70c01b2132

See more details on using hashes here.

Provenance

The following attestation bundles were made for udsonip-0.2.1-py3-none-any.whl:

Publisher: publish.yml on sirius-cc-wu/python-udsonip

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page