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

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

endpoint.start()

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

# 切换到已连接的 ECU,发送诊断请求
endpoint.select(0x1301)
response = endpoint.send(bytes.fromhex('22DC06'))
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.1.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.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autodoip-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a1e08ff9e0c033bcf224996db810b7646fa64e70069a5aa18f2dca6c87befbbc
MD5 0f7ccac7772d6bea9330fe693c1a2ef5
BLAKE2b-256 9067d3fb549b2174f4d25242c4970b46a5c6595a849b0efca086a9bc283d278b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autodoip-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 34eb5f9b2c0a4d94c8e9c30c64271988aacb1f1b1373e8f32c64cef4bdaaa21a
MD5 c305e346629065fa7c291dbce257c844
BLAKE2b-256 bace23fd7808c67bdfa1dc02861de05a7a4773bcf52bd2bf416524ac0ecd2f88

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