Skip to main content

DoIP (Diagnostics over IP) transport layer for automotive UDS — ISO 13400

Project description

autodoip

DoIP (Diagnostics over IP) transport layer for automotive UDS communication — ISO 13400.

Installation

pip install autodoip

Quick Start

from autodoip import Endpoint

# 创建端点 — 监听 192.168.10.1:13400,等待 ECU 连接
endpoint = Endpoint(
    ip='192.168.10.1',
    ecus={
        0x1301: ('192.168.10.10', 0),     # port=0 忽略端口校验
        0x1302: ('192.168.10.20', 13400), # 精确匹配 IP + port
    },
)

endpoint.start()

# 查看连接状态
print(endpoint.connections())
# {0x1301: ('192.168.10.10', 0, True), 0x1302: ('192.168.10.20', 13400, False)}

# 切换到已连接的 ECU,发送诊断请求
endpoint.select(0x1301)
response = endpoint.send(bytes.fromhex('22FF00'))
print(response.hex(' '))

endpoint.stop()

API

符号 说明
Endpoint(ip, ecus, port, tester, config) DoIP 端点。ip + ecus 必传
Endpoint.start() 启动监听,幂等
Endpoint.stop() 关闭所有连接
Endpoint.select(addr) -> bool 切换 ECU,成功返 True;未连接返 False 不切不退
Endpoint.send(payload) -> bytes 发送 UDS 载荷,返回响应。通信中断自动重连一次
Endpoint.connections() -> dict {addr: (ip, port, connected), ...}
Config(accept_timeout=..., recv_timeout=..., ...) 传输调优参数,全部有默认值
ProtocolError 帧格式校验失败

Configuration

from autodoip import Config

Config(
    accept_timeout=1.5,   # accept 超时 (s)
    recv_timeout=3.0,     # recv 超时 (s)
    listen_count=5,       # socket backlog
    version=0x02,         # DoIP 协议版本
    msg_type=0x8001,      # Payload Type
    byte_order='big',     # 字节序
)

Requirements

  • Python >= 3.14
  • Zero external dependencies (stdlib only)

License

MIT

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

autodoip-0.1.2.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

autodoip-0.1.2-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file autodoip-0.1.2.tar.gz.

File metadata

  • Download URL: autodoip-0.1.2.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for autodoip-0.1.2.tar.gz
Algorithm Hash digest
SHA256 79cc9b2563466907f159fb0f288f2b5dc76ea5a597853e337ccdaa13645dcd1d
MD5 f418facdb2fee52bcc254af9de23ff35
BLAKE2b-256 ea1bcdde501b8c9c848d34e5862fadedc3dca29665531d764383502bce054017

See more details on using hashes here.

File details

Details for the file autodoip-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: autodoip-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for autodoip-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c7ec78f5a94833f9bf67626052f31965b3225cea0f13be7060a4f73645078f20
MD5 7b866ab6c31f32feb23809ca4c933662
BLAKE2b-256 5e12324aa205e84685875e6d150712a2d33c1f84b9a8e4c02818f20dc80a55fc

See more details on using hashes here.

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