xusbcan-cli 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. {xusbcan_cli-0.1.1/src/xusbcan_cli.egg-info → xusbcan_cli-0.1.3}/PKG-INFO +28 -3
  2. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/README.md +17 -2
  3. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/pyproject.toml +25 -1
  4. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/__init__.py +1 -1
  5. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3/src/xusbcan_cli.egg-info}/PKG-INFO +28 -3
  6. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan_cli.egg-info/entry_points.txt +1 -0
  7. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/LICENSE +0 -0
  8. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/setup.cfg +0 -0
  9. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/__init__.py +0 -0
  10. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/chuangxin/__init__.py +0 -0
  11. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/chuangxin/backend.py +0 -0
  12. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/chuangxin/bus.py +0 -0
  13. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/chuangxin/device_pool.py +0 -0
  14. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/chuangxin/dll.py +0 -0
  15. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/chuangxin/profiles.py +0 -0
  16. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/peak/__init__.py +0 -0
  17. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/peak/profiles.py +0 -0
  18. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/profile.py +0 -0
  19. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/registry.py +0 -0
  20. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/vector/__init__.py +0 -0
  21. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/vector/profiles.py +0 -0
  22. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/zlg/__init__.py +0 -0
  23. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/zlg/backend.py +0 -0
  24. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/zlg/common.py +0 -0
  25. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/zlg/device_pool.py +0 -0
  26. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/zlg/dll.py +0 -0
  27. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/zlg/profiles.py +0 -0
  28. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/zlg/usbcan2.py +0 -0
  29. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/adapters/zlg/usbcan_2e_u.py +0 -0
  30. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/cli/__init__.py +0 -0
  31. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/cli/__main__.py +0 -0
  32. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/cli/app.py +0 -0
  33. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/config/__init__.py +0 -0
  34. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/config/loader.py +0 -0
  35. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/core/__init__.py +0 -0
  36. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/core/commands.py +0 -0
  37. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/core/filters.py +0 -0
  38. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/core/monitor.py +0 -0
  39. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/core/periodic.py +0 -0
  40. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/core/session.py +0 -0
  41. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/mcp/__init__.py +0 -0
  42. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/mcp/server.py +0 -0
  43. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/mcp/tools.py +0 -0
  44. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/mcp/transport.py +0 -0
  45. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/models/__init__.py +0 -0
  46. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/models/device.py +0 -0
  47. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/models/frame.py +0 -0
  48. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/models/result.py +0 -0
  49. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/scenario/__init__.py +0 -0
  50. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/scenario/loader.py +0 -0
  51. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan/scenario/runner.py +0 -0
  52. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan_cli.egg-info/SOURCES.txt +0 -0
  53. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan_cli.egg-info/dependency_links.txt +0 -0
  54. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan_cli.egg-info/requires.txt +0 -0
  55. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/src/xusbcan_cli.egg-info/top_level.txt +0 -0
  56. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_chuangxin_usb_can_2c.py +0 -0
  57. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_config.py +0 -0
  58. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_core.py +0 -0
  59. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_dual_session_virtual.py +0 -0
  60. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_error_code_mapping.py +0 -0
  61. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_filters.py +0 -0
  62. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_mcp_smoke.py +0 -0
  63. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_mcp_stdio.py +0 -0
  64. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_models.py +0 -0
  65. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_registry.py +0 -0
  66. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_result.py +0 -0
  67. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_scenario.py +0 -0
  68. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_scenario_advanced.py +0 -0
  69. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_scenario_store.py +0 -0
  70. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_scenario_vars.py +0 -0
  71. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_session_capabilities.py +0 -0
  72. {xusbcan_cli-0.1.1 → xusbcan_cli-0.1.3}/tests/test_zlg_usbcan2.py +0 -0
@@ -1,9 +1,19 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xusbcan-cli
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: 面向 AI Agent 的 CAN 总线调试工具(CLI + MCP)
5
5
  Author: Archaofan
6
6
  License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Archaofan/xusbcan-cli
8
+ Project-URL: Repository, https://github.com/Archaofan/xusbcan-cli
9
+ Project-URL: Documentation, https://deepwiki.com/Archaofan/xusbcan-cli
10
+ Project-URL: Issues, https://github.com/Archaofan/xusbcan-cli/issues
11
+ Project-URL: Changelog, https://github.com/Archaofan/xusbcan-cli/releases
12
+ Keywords: can,can-bus,mcp,model-context-protocol,python-can,ai-agent,automotive,embedded,cli
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Software Development :: Embedded Systems
16
+ Classifier: Topic :: System :: Hardware
7
17
  Classifier: Programming Language :: Python :: 3
8
18
  Classifier: Programming Language :: Python :: 3.11
9
19
  Classifier: Programming Language :: Python :: 3.12
@@ -28,6 +38,9 @@ Dynamic: license-file
28
38
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
29
39
  [![Python 3.11+](https://img.shields.io/badge/Python-3.11%2B-blue.svg)](https://www.python.org/)
30
40
  [![PyPI](https://img.shields.io/pypi/v/xusbcan-cli.svg)](https://pypi.org/project/xusbcan-cli/)
41
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Archaofan/xusbcan-cli)
42
+
43
+ <!-- mcp-name: io.github.Archaofan/xusbcan -->
31
44
 
32
45
  中文 | [English](README.en.md)
33
46
 
@@ -44,10 +57,14 @@ Dynamic: license-file
44
57
  - **python-can 优先**:已有后端可直接写 `interface`;需要通道映射或专有参数时再登记型号
45
58
  - **可安装 Agent Skill**:先确认型号,再调用;厂商踩坑按型号分文件
46
59
 
60
+ ![Agent to bus flow](assets/agent-flow.svg)
61
+
47
62
  ## 会话层做什么
48
63
 
49
64
  本项目在 python-can(或自研后端给出的 `can.Bus`)之上提供**统一会话与命令层**,而不是再实现一套总线协议栈。大致包括:
50
65
 
66
+ ![Session layer on python-can](assets/architecture.svg)
67
+
51
68
  - **配置与别名**:`xusbcan.toml` 里用逻辑名引用设备,打开参数集中管理
52
69
  - **会话生命周期**:按别名 `open` / `close`,多卡并存;关闭时收回周期任务与有界监听
53
70
  - **统一结果契约**:`Result` + `error.code` 枚举,超时收帧等可程序化分支(不必解析人类日志)
@@ -122,6 +139,10 @@ xusbcan scenario --file steps.json
122
139
  xusbcan scenario --dir scenarios/
123
140
  ```
124
141
 
142
+ ![CLI lab demo](assets/demo-cli.png)
143
+
144
+ *台架 / lab 演示(路径已脱敏;非实车)*
145
+
125
146
  `periodic` 在本进程发满 `--duration` 后停止。`scenario` 在同进程编排发→等→再发;`--dir` 按文件名批跑。跨多次调用保持会话时用 MCP。
126
147
 
127
148
  ### MCP
@@ -132,6 +153,10 @@ xusbcan-mcp
132
153
 
133
154
  Agent 使用 `open_device`、`send_frame`、`receive_frame`、`monitor`、`periodic_start` 等工具。`periodic_start` **必须**带 `duration_s`(上限 300 秒)。更长任务请用本机常驻进程,并明确授权台架环境。
134
155
 
156
+ ![MCP lab demo](assets/demo-mcp.png)
157
+
158
+ *台架 / lab 演示:MCP 工具调用成绩单(配置路径已脱敏;非 Cursor UI 截图;非实车)*
159
+
135
160
  注册时按所用适配器设置对应环境变量与 `XUSBCAN_CONFIG`(见下方各厂商小节)。
136
161
 
137
162
  ## 适配器准备
@@ -160,11 +185,11 @@ set ZLG_SDK_DIR=D:\path\to\zlg-sdk-dir
160
185
  name = "bus0"
161
186
  vendor = "zlg"
162
187
  model = "USBCAN-2E-U" # 或 "USBCAN-II"
163
- channel = 1
188
+ channel = 1 # 按实际接线:CAN1→0,CAN2→1
164
189
  nominal = 250000
165
190
  ```
166
191
 
167
- 滤波与周期发送在两种型号上的路径不同,见 Agent Skill 中对应参考页。
192
+ 2E-U / II 均为双通道,`channel` 必须对应实际接线口。型号以铭牌与配置 `model` 为准;不要根据 SDK `GetDeviceInf` 一类字段改判型号或改走 CAN FD。滤波与周期发送路径因型号而异,见 Agent Skill 对应参考页。
168
193
 
169
194
  ```json
170
195
  {
@@ -7,6 +7,9 @@
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
8
8
  [![Python 3.11+](https://img.shields.io/badge/Python-3.11%2B-blue.svg)](https://www.python.org/)
9
9
  [![PyPI](https://img.shields.io/pypi/v/xusbcan-cli.svg)](https://pypi.org/project/xusbcan-cli/)
10
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Archaofan/xusbcan-cli)
11
+
12
+ <!-- mcp-name: io.github.Archaofan/xusbcan -->
10
13
 
11
14
  中文 | [English](README.en.md)
12
15
 
@@ -23,10 +26,14 @@
23
26
  - **python-can 优先**:已有后端可直接写 `interface`;需要通道映射或专有参数时再登记型号
24
27
  - **可安装 Agent Skill**:先确认型号,再调用;厂商踩坑按型号分文件
25
28
 
29
+ ![Agent to bus flow](assets/agent-flow.svg)
30
+
26
31
  ## 会话层做什么
27
32
 
28
33
  本项目在 python-can(或自研后端给出的 `can.Bus`)之上提供**统一会话与命令层**,而不是再实现一套总线协议栈。大致包括:
29
34
 
35
+ ![Session layer on python-can](assets/architecture.svg)
36
+
30
37
  - **配置与别名**:`xusbcan.toml` 里用逻辑名引用设备,打开参数集中管理
31
38
  - **会话生命周期**:按别名 `open` / `close`,多卡并存;关闭时收回周期任务与有界监听
32
39
  - **统一结果契约**:`Result` + `error.code` 枚举,超时收帧等可程序化分支(不必解析人类日志)
@@ -101,6 +108,10 @@ xusbcan scenario --file steps.json
101
108
  xusbcan scenario --dir scenarios/
102
109
  ```
103
110
 
111
+ ![CLI lab demo](assets/demo-cli.png)
112
+
113
+ *台架 / lab 演示(路径已脱敏;非实车)*
114
+
104
115
  `periodic` 在本进程发满 `--duration` 后停止。`scenario` 在同进程编排发→等→再发;`--dir` 按文件名批跑。跨多次调用保持会话时用 MCP。
105
116
 
106
117
  ### MCP
@@ -111,6 +122,10 @@ xusbcan-mcp
111
122
 
112
123
  Agent 使用 `open_device`、`send_frame`、`receive_frame`、`monitor`、`periodic_start` 等工具。`periodic_start` **必须**带 `duration_s`(上限 300 秒)。更长任务请用本机常驻进程,并明确授权台架环境。
113
124
 
125
+ ![MCP lab demo](assets/demo-mcp.png)
126
+
127
+ *台架 / lab 演示:MCP 工具调用成绩单(配置路径已脱敏;非 Cursor UI 截图;非实车)*
128
+
114
129
  注册时按所用适配器设置对应环境变量与 `XUSBCAN_CONFIG`(见下方各厂商小节)。
115
130
 
116
131
  ## 适配器准备
@@ -139,11 +154,11 @@ set ZLG_SDK_DIR=D:\path\to\zlg-sdk-dir
139
154
  name = "bus0"
140
155
  vendor = "zlg"
141
156
  model = "USBCAN-2E-U" # 或 "USBCAN-II"
142
- channel = 1
157
+ channel = 1 # 按实际接线:CAN1→0,CAN2→1
143
158
  nominal = 250000
144
159
  ```
145
160
 
146
- 滤波与周期发送在两种型号上的路径不同,见 Agent Skill 中对应参考页。
161
+ 2E-U / II 均为双通道,`channel` 必须对应实际接线口。型号以铭牌与配置 `model` 为准;不要根据 SDK `GetDeviceInf` 一类字段改判型号或改走 CAN FD。滤波与周期发送路径因型号而异,见 Agent Skill 对应参考页。
147
162
 
148
163
  ```json
149
164
  {
@@ -4,22 +4,44 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xusbcan-cli"
7
- version = "0.1.1"
7
+ version = "0.1.3"
8
8
  description = "面向 AI Agent 的 CAN 总线调试工具(CLI + MCP)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
11
11
  license = "MIT"
12
12
  license-files = ["LICENSE"]
13
13
  authors = [{ name = "Archaofan" }]
14
+ keywords = [
15
+ "can",
16
+ "can-bus",
17
+ "mcp",
18
+ "model-context-protocol",
19
+ "python-can",
20
+ "ai-agent",
21
+ "automotive",
22
+ "embedded",
23
+ "cli",
24
+ ]
14
25
  dependencies = [
15
26
  "python-can>=4.4",
16
27
  ]
17
28
  classifiers = [
29
+ "Development Status :: 3 - Alpha",
30
+ "Intended Audience :: Developers",
31
+ "Topic :: Software Development :: Embedded Systems",
32
+ "Topic :: System :: Hardware",
18
33
  "Programming Language :: Python :: 3",
19
34
  "Programming Language :: Python :: 3.11",
20
35
  "Programming Language :: Python :: 3.12",
21
36
  ]
22
37
 
38
+ [project.urls]
39
+ Homepage = "https://github.com/Archaofan/xusbcan-cli"
40
+ Repository = "https://github.com/Archaofan/xusbcan-cli"
41
+ Documentation = "https://deepwiki.com/Archaofan/xusbcan-cli"
42
+ Issues = "https://github.com/Archaofan/xusbcan-cli/issues"
43
+ Changelog = "https://github.com/Archaofan/xusbcan-cli/releases"
44
+
23
45
  [project.optional-dependencies]
24
46
  mcp = ["mcp>=2.0"]
25
47
  dev = ["pytest", "ruff", "mypy"]
@@ -27,6 +49,8 @@ dev = ["pytest", "ruff", "mypy"]
27
49
  [project.scripts]
28
50
  xusbcan = "xusbcan.cli.app:main"
29
51
  xusbcan-mcp = "xusbcan.mcp.server:main"
52
+ # Same name as the PyPI package so `uvx xusbcan-cli` / MCP Registry can launch MCP.
53
+ xusbcan-cli = "xusbcan.mcp.server:main"
30
54
 
31
55
  [project.entry-points."can.interface"]
32
56
  zlg = "xusbcan.adapters.zlg.backend:ZlgBus"
@@ -4,4 +4,4 @@
4
4
  (无 zlgcan.dll)上也能 `import xusbcan`,`virtual` 后端测试才能运行。
5
5
  """
6
6
 
7
- __version__ = "0.1.1"
7
+ __version__ = "0.1.2"
@@ -1,9 +1,19 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xusbcan-cli
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: 面向 AI Agent 的 CAN 总线调试工具(CLI + MCP)
5
5
  Author: Archaofan
6
6
  License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Archaofan/xusbcan-cli
8
+ Project-URL: Repository, https://github.com/Archaofan/xusbcan-cli
9
+ Project-URL: Documentation, https://deepwiki.com/Archaofan/xusbcan-cli
10
+ Project-URL: Issues, https://github.com/Archaofan/xusbcan-cli/issues
11
+ Project-URL: Changelog, https://github.com/Archaofan/xusbcan-cli/releases
12
+ Keywords: can,can-bus,mcp,model-context-protocol,python-can,ai-agent,automotive,embedded,cli
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Software Development :: Embedded Systems
16
+ Classifier: Topic :: System :: Hardware
7
17
  Classifier: Programming Language :: Python :: 3
8
18
  Classifier: Programming Language :: Python :: 3.11
9
19
  Classifier: Programming Language :: Python :: 3.12
@@ -28,6 +38,9 @@ Dynamic: license-file
28
38
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
29
39
  [![Python 3.11+](https://img.shields.io/badge/Python-3.11%2B-blue.svg)](https://www.python.org/)
30
40
  [![PyPI](https://img.shields.io/pypi/v/xusbcan-cli.svg)](https://pypi.org/project/xusbcan-cli/)
41
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Archaofan/xusbcan-cli)
42
+
43
+ <!-- mcp-name: io.github.Archaofan/xusbcan -->
31
44
 
32
45
  中文 | [English](README.en.md)
33
46
 
@@ -44,10 +57,14 @@ Dynamic: license-file
44
57
  - **python-can 优先**:已有后端可直接写 `interface`;需要通道映射或专有参数时再登记型号
45
58
  - **可安装 Agent Skill**:先确认型号,再调用;厂商踩坑按型号分文件
46
59
 
60
+ ![Agent to bus flow](assets/agent-flow.svg)
61
+
47
62
  ## 会话层做什么
48
63
 
49
64
  本项目在 python-can(或自研后端给出的 `can.Bus`)之上提供**统一会话与命令层**,而不是再实现一套总线协议栈。大致包括:
50
65
 
66
+ ![Session layer on python-can](assets/architecture.svg)
67
+
51
68
  - **配置与别名**:`xusbcan.toml` 里用逻辑名引用设备,打开参数集中管理
52
69
  - **会话生命周期**:按别名 `open` / `close`,多卡并存;关闭时收回周期任务与有界监听
53
70
  - **统一结果契约**:`Result` + `error.code` 枚举,超时收帧等可程序化分支(不必解析人类日志)
@@ -122,6 +139,10 @@ xusbcan scenario --file steps.json
122
139
  xusbcan scenario --dir scenarios/
123
140
  ```
124
141
 
142
+ ![CLI lab demo](assets/demo-cli.png)
143
+
144
+ *台架 / lab 演示(路径已脱敏;非实车)*
145
+
125
146
  `periodic` 在本进程发满 `--duration` 后停止。`scenario` 在同进程编排发→等→再发;`--dir` 按文件名批跑。跨多次调用保持会话时用 MCP。
126
147
 
127
148
  ### MCP
@@ -132,6 +153,10 @@ xusbcan-mcp
132
153
 
133
154
  Agent 使用 `open_device`、`send_frame`、`receive_frame`、`monitor`、`periodic_start` 等工具。`periodic_start` **必须**带 `duration_s`(上限 300 秒)。更长任务请用本机常驻进程,并明确授权台架环境。
134
155
 
156
+ ![MCP lab demo](assets/demo-mcp.png)
157
+
158
+ *台架 / lab 演示:MCP 工具调用成绩单(配置路径已脱敏;非 Cursor UI 截图;非实车)*
159
+
135
160
  注册时按所用适配器设置对应环境变量与 `XUSBCAN_CONFIG`(见下方各厂商小节)。
136
161
 
137
162
  ## 适配器准备
@@ -160,11 +185,11 @@ set ZLG_SDK_DIR=D:\path\to\zlg-sdk-dir
160
185
  name = "bus0"
161
186
  vendor = "zlg"
162
187
  model = "USBCAN-2E-U" # 或 "USBCAN-II"
163
- channel = 1
188
+ channel = 1 # 按实际接线:CAN1→0,CAN2→1
164
189
  nominal = 250000
165
190
  ```
166
191
 
167
- 滤波与周期发送在两种型号上的路径不同,见 Agent Skill 中对应参考页。
192
+ 2E-U / II 均为双通道,`channel` 必须对应实际接线口。型号以铭牌与配置 `model` 为准;不要根据 SDK `GetDeviceInf` 一类字段改判型号或改走 CAN FD。滤波与周期发送路径因型号而异,见 Agent Skill 对应参考页。
168
193
 
169
194
  ```json
170
195
  {
@@ -4,4 +4,5 @@ zlg = xusbcan.adapters.zlg.backend:ZlgBus
4
4
 
5
5
  [console_scripts]
6
6
  xusbcan = xusbcan.cli.app:main
7
+ xusbcan-cli = xusbcan.mcp.server:main
7
8
  xusbcan-mcp = xusbcan.mcp.server:main
File without changes
File without changes