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)
for response in endpoint.conversation(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.conversation(payload) -> Iterator[bytes] |
发送 UDS 载荷,返回响应迭代器。通信中断自动重连一次。支持多帧响应(如延迟指示 0x7F...0x78) |
Endpoint.current -> int | None |
当前选中的 ECU 逻辑地址 |
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.3.tar.gz
(16.4 kB
view details)
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 autodoip-0.1.3.tar.gz.
File metadata
- Download URL: autodoip-0.1.3.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0f54ef3e598752b4409c65cc5761ac1191e8b83f57372a83f73c57879dd44ac
|
|
| MD5 |
7deb51835d1b862297a1eda427e6e7ec
|
|
| BLAKE2b-256 |
1b9ab5d5423479f2ee2177896ddee4565bd3c7df1fc27de2c52c5f57ba58f024
|
File details
Details for the file autodoip-0.1.3-py3-none-any.whl.
File metadata
- Download URL: autodoip-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b70cce9b2ae81e43160fd11968e7ae2642a545283060d5b53a69cb8c12f213e
|
|
| MD5 |
3c521e47f25542d0e5cd0fa72f6e0bc3
|
|
| BLAKE2b-256 |
3fbc110d5438f19b800a2a147497559294e9235afc64b5609a340dd2ec027b8b
|