From 559890c482f5973f06aafdfec9550fee5ba3c7f2 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 09 十一月 2026 17:02:15 +0800
Subject: [PATCH] feat: CAN 模拟器 TCP 化 + 多设备并发调试 + 后台生命周期管理
---
docs/broker-ipc-comparison.html | 348 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 348 insertions(+), 0 deletions(-)
diff --git a/docs/broker-ipc-comparison.html b/docs/broker-ipc-comparison.html
new file mode 100644
index 0000000..367935a
--- /dev/null
+++ b/docs/broker-ipc-comparison.html
@@ -0,0 +1,348 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Broker IPC 鏂规瀵规瘮锛歂amed Pipes vs COM Interop</title>
+ <style>
+ :root {
+ --primary: #2563eb;
+ --primary-light: #dbeafe;
+ --success: #16a34a;
+ --success-light: #dcfce7;
+ --warning: #d97706;
+ --warning-light: #fef3c7;
+ --danger: #dc2626;
+ --danger-light: #fee2e2;
+ --gray-50: #f9fafb;
+ --gray-100: #f3f4f6;
+ --gray-200: #e5e7eb;
+ --gray-600: #4b5563;
+ --gray-800: #1f2937;
+ --gray-900: #111827;
+ }
+
+ * { margin: 0; padding: 0; box-sizing: border-box; }
+
+ body {
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
+ line-height: 1.7;
+ color: var(--gray-800);
+ background: linear-gradient(135deg, #f0f4ff 0%, #fafbff 100%);
+ padding: 2rem 1rem;
+ }
+
+ .container {
+ max-width: 960px;
+ margin: 0 auto;
+ }
+
+ header {
+ text-align: center;
+ margin-bottom: 2.5rem;
+ }
+
+ header h1 {
+ font-size: 1.8rem;
+ color: var(--gray-900);
+ margin-bottom: 0.5rem;
+ }
+
+ header .subtitle {
+ color: var(--gray-600);
+ font-size: 0.95rem;
+ }
+
+ .badge {
+ display: inline-block;
+ padding: 0.15rem 0.6rem;
+ border-radius: 999px;
+ font-size: 0.75rem;
+ font-weight: 600;
+ margin-left: 0.4rem;
+ vertical-align: middle;
+ }
+ .badge-rec { background: var(--success-light); color: var(--success); }
+ .badge-alt { background: var(--warning-light); color: var(--warning); }
+
+ /* ---- Comparison Table ---- */
+ .table-wrap {
+ overflow-x: auto;
+ margin-bottom: 2rem;
+ border-radius: 12px;
+ box-shadow: 0 1px 3px rgba(0,0,0,.08);
+ }
+
+ table {
+ width: 100%;
+ border-collapse: collapse;
+ background: #fff;
+ font-size: 0.92rem;
+ }
+
+ thead th {
+ background: var(--primary);
+ color: #fff;
+ padding: 0.85rem 1rem;
+ text-align: left;
+ font-weight: 600;
+ white-space: nowrap;
+ }
+ thead th:first-child { border-radius: 12px 0 0 0; }
+ thead th:last-child { border-radius: 0 12px 0 0; }
+
+ tbody td {
+ padding: 0.75rem 1rem;
+ border-bottom: 1px solid var(--gray-200);
+ vertical-align: top;
+ }
+
+ tbody tr:last-child td { border-bottom: none; }
+ tbody tr:nth-child(even) { background: var(--gray-50); }
+
+ td:first-child {
+ font-weight: 600;
+ color: var(--gray-900);
+ white-space: nowrap;
+ }
+
+ .cell-good { color: var(--success); font-weight: 500; }
+ .cell-bad { color: var(--danger); font-weight: 500; }
+ .cell-neutral { color: var(--warning); font-weight: 500; }
+
+ /* ---- Sections ---- */
+ .section {
+ background: #fff;
+ border-radius: 12px;
+ padding: 1.8rem 2rem;
+ margin-bottom: 1.5rem;
+ box-shadow: 0 1px 3px rgba(0,0,0,.08);
+ }
+
+ .section h2 {
+ font-size: 1.2rem;
+ color: var(--primary);
+ margin-bottom: 1rem;
+ padding-bottom: 0.5rem;
+ border-bottom: 2px solid var(--primary-light);
+ }
+
+ .section h3 {
+ font-size: 1rem;
+ color: var(--gray-900);
+ margin: 1.2rem 0 0.6rem;
+ }
+
+ /* ---- Factor Cards ---- */
+ .factor-grid {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 1rem;
+ margin-top: 1rem;
+ }
+ @media (max-width: 640px) { .factor-grid { grid-template-columns: 1fr; } }
+
+ .factor-card {
+ border: 1px solid var(--gray-200);
+ border-radius: 8px;
+ padding: 1rem 1.2rem;
+ }
+ .factor-card h4 {
+ font-size: 0.88rem;
+ margin-bottom: 0.4rem;
+ color: var(--gray-900);
+ }
+ .factor-card p {
+ font-size: 0.85rem;
+ color: var(--gray-600);
+ line-height: 1.6;
+ }
+ .factor-card.pro { border-left: 4px solid var(--success); }
+ .factor-card.con { border-left: 4px solid var(--danger); }
+
+ /* ---- Recommendation ---- */
+ .recommendation {
+ background: var(--success-light);
+ border: 1px solid #86efac;
+ border-radius: 10px;
+ padding: 1.5rem 2rem;
+ margin-top: 1.5rem;
+ }
+ .recommendation h2 {
+ color: var(--success);
+ border-bottom-color: #86efac;
+ }
+ .recommendation ul {
+ margin: 0.8rem 0 0 1.2rem;
+ }
+ .recommendation li {
+ margin-bottom: 0.4rem;
+ font-size: 0.92rem;
+ }
+
+ /* ---- Code Hint ---- */
+ code {
+ background: var(--gray-100);
+ padding: 0.15rem 0.4rem;
+ border-radius: 4px;
+ font-size: 0.88em;
+ font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
+ }
+
+ footer {
+ text-align: center;
+ margin-top: 2rem;
+ color: var(--gray-600);
+ font-size: 0.8rem;
+ }
+ </style>
+</head>
+<body>
+<div class="container">
+
+ <header>
+ <h1>Broker IPC 鏂规瀵规瘮</h1>
+ <p class="subtitle">Named Pipes vs COM Interop | TapProject V3.0 MVP 鏋舵瀯璇勪及</p>
+ </header>
+
+ <!-- ===================== Comparison Table ===================== -->
+ <div class="table-wrap">
+ <table>
+ <thead>
+ <tr>
+ <th>璇勪及缁村害</th>
+ <th>Named Pipes <span class="badge badge-rec">鎺ㄨ崘</span></th>
+ <th>COM Interop <span class="badge badge-alt">澶囬��</span></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>閮ㄧ讲澶嶆潅搴�</td>
+ <td class="cell-good">浣� 鈥� 鍙渶绠¢亾鍚嶇害瀹氾紝鏃犻渶娉ㄥ唽缁勪欢</td>
+ <td class="cell-bad">楂� 鈥� 闇� RegAsm / regsvr32 娉ㄥ唽 COM 缁勪欢锛岄厤缃� DCOM 鏉冮檺</td>
+ </tr>
+ <tr>
+ <td>寮虹被鍨嬩綋楠�</td>
+ <td class="cell-neutral">寮� 鈥� 闇�鎵嬪姩搴忓垪鍖�/鍙嶅簭鍒楀寲锛圝SON / Protobuf锛�</td>
+ <td class="cell-good">寮� 鈥� .NET 鑷姩鐢熸垚 RCW锛屾帴鍙h皟鐢ㄥ鍚屾湰鍦板璞�</td>
+ </tr>
+ <tr>
+ <td>璺ㄦ満鍣ㄦ墿灞�</td>
+ <td class="cell-good">澶╃劧鏀寔 鈥� 鍙钩婊戝垏鎹㈠埌 TCP / gRPC</td>
+ <td class="cell-bad">闇� DCOM锛岄槻鐏涓庣綉缁滈厤缃鏉�</td>
+ </tr>
+ <tr>
+ <td>鏉冮檺瑕佹眰</td>
+ <td class="cell-good">浣� 鈥� 鍚屾満绠¢亾璁块棶鍗冲彲锛屾棤闇�鐗规畩鏉冮檺</td>
+ <td class="cell-bad">闇� DCOM 鏉冮檺閰嶇疆锛屼紒涓氬畨鍏ㄧ瓥鐣ュ父鍙楅檺</td>
+ </tr>
+ <tr>
+ <td>鏈潵 .NET 鍏煎鎬�</td>
+ <td class="cell-good">瀹屽叏鍏煎 .NET 6 / 7 / 8+</td>
+ <td class="cell-bad">Microsoft 宸查�愭寮卞寲 COM 鎶曞叆锛�.NET Core 鏀寔鏈夐檺</td>
+ </tr>
+ <tr>
+ <td>鎬ц兘</td>
+ <td class="cell-neutral">JSON 鏈夊簭鍒楀寲寮�閿�锛屼絾绠¢亾鏈韩楂樻晥锛涘彲鎹� Protobuf 浼樺寲</td>
+ <td class="cell-good">浜岃繘鍒� marshaling 寮�閿�灏忥紝浣嗘湁棰濆 proxy/stub 灞�</td>
+ </tr>
+ <tr>
+ <td>璋冭瘯 / 杩愮淮</td>
+ <td class="cell-good">绠¢亾鐘舵�佹槗鎺掓煡锛屾棩蹇楃洿瑙�</td>
+ <td class="cell-bad">COM 娉ㄥ唽闂銆佹潈闄愰棶棰樻槸甯歌鏁呴殰婧�</td>
+ </tr>
+ <tr>
+ <td>涓庣幇鏈変唬鐮侀泦鎴�</td>
+ <td class="cell-neutral">闇�缂栧啓杩炴帴绠$悊銆佸抚瑙f瀽閫昏緫</td>
+ <td class="cell-good">鎺ュ彛瀹氫箟鍚庡鎴风浠g爜绠�娲侊紝绫讳技鏈湴璋冪敤</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <!-- ===================== Key Factors ===================== -->
+ <div class="section">
+ <h2>鍏抽敭鑰冮噺鍥犵礌</h2>
+
+ <h3>COM Interop 閫傚悎鐨勫満鏅�</h3>
+ <div class="factor-grid">
+ <div class="factor-card pro">
+ <h4>鉁� 鍚屾満閫氫俊 + 寮虹被鍨嬮渶姹�</h4>
+ <p>Broker 涓庡鎴风姘歌繙鍦ㄥ悓涓�鍙版満鍣紝鍥㈤槦鐔熸倝 COM 閮ㄧ讲锛屽笇鏈涜幏寰楅�忔槑浠g悊鑸殑璋冪敤浣撻獙銆�</p>
+ </div>
+ <div class="factor-card pro">
+ <h4>鉁� 宸叉湁 COM 缁勪欢璧勪骇</h4>
+ <p>椤圭洰涓凡鏈夋垚鐔熺殑 COM 鎺ュ彛瀹氫箟鎴栫涓夋柟 COM 缁勪欢锛屽彲鐩存帴澶嶇敤銆�</p>
+ </div>
+ </div>
+
+ <h3>Named Pipes 鏇撮�傚悎鐨勭悊鐢�</h3>
+ <div class="factor-grid">
+ <div class="factor-card con">
+ <h4>馃殌 閮ㄧ讲绠�鍗�</h4>
+ <p>鏃犻渶娉ㄥ唽 COM 缁勪欢锛岀閬撳悕绾﹀畾鍗冲彲閫氫俊锛岃繍缁存垚鏈瀬浣庛��</p>
+ </div>
+ <div class="factor-card con">
+ <h4>馃敆 璺ㄦ満鍣ㄦ墿灞�</h4>
+ <p>鏈潵鑻� Broker 闇�閮ㄧ讲鍒拌繙绋嬫満鍣紝Named Pipes 鍙钩婊戝垏鎹㈠埌 TCP/gRPC锛孋OM Interop 鍒欓渶澶у箙鏀归�犮��</p>
+ </div>
+ <div class="factor-card con">
+ <h4>馃洝锔� 浼佷笟鐜鍙嬪ソ</h4>
+ <p>DCOM 鏉冮檺鍦ㄤ紒涓氬畨鍏ㄧ瓥鐣ヤ笅缁忓父鍙楅檺锛孨amed Pipes 鏃犳闂銆�</p>
+ </div>
+ <div class="factor-card con">
+ <h4>馃摝 鐜颁唬 .NET 鍏煎</h4>
+ <p>椤圭洰铏藉綋鍓嶄负 .NET Framework 4.7.2锛屼絾 COM Interop 鍦� .NET 5+ 涓婃敮鎸侀�愭寮卞寲锛孨amed Pipes 鏃犳椤捐檻銆�</p>
+ </div>
+ </div>
+ </div>
+
+ <!-- ===================== Recommendation ===================== -->
+ <div class="recommendation">
+ <h2>缁撹涓庡缓璁�</h2>
+ <p><strong>淇濇寔 Named Pipes 鏂规銆�</strong></p>
+ <p>瀵逛簬 Broker 璺ㄨ繘绋嬮�氫俊鍦烘櫙锛孨amed Pipes 鍦�<strong>閮ㄧ讲绠�鏄撴��</strong>銆�<strong>鏈潵鎵╁睍鎬�</strong>鍜�<strong>骞冲彴鍏煎鎬�</strong>涓婂潎浼樹簬 COM Interop銆�</p>
+ <ul>
+ <li>濡傛灉鎷呭績 JSON 搴忓垪鍖栧紑閿�锛屽彲鑰冭檻鐢� <code>MemoryPack</code> 鎴� <code>Protobuf-net</code> 鏇夸唬锛屽悓鏃朵繚鐣� Named Pipes 鐨勬灦鏋勪紭鍔裤��</li>
+ <li>褰撳墠 MVP 甯у崗璁璁★紙4 瀛楄妭闀垮害鍓嶇紑 + UTF8 JSON锛夊凡瓒冲娓呮櫚锛屽悗缁紭鍖栫┖闂村ぇ銆�</li>
+ <li>COM Interop 浠呭湪"鍥㈤槦宸叉湁鎴愮啛 COM 璧勪骇 + 纭畾姘镐笉璺ㄦ満鍣�"鐨勫墠鎻愪笅鎵嶅�煎緱鑰冭檻銆�</li>
+ </ul>
+ </div>
+
+ <!-- ===================== Architecture Context ===================== -->
+ <div class="section">
+ <h2>褰撳墠 MVP 鏋舵瀯涓殑 IPC 瀹氫綅</h2>
+ <p>鍦ㄥ凡瀹屾垚鐨� MVP 瀹炴柦涓紝璺ㄨ繘绋嬮�氫俊鍒嗕负涓ゅ眰锛�</p>
+ <table style="margin-top: 1rem;">
+ <thead>
+ <tr>
+ <th style="width:30%">灞傜骇</th>
+ <th>鏈哄埗</th>
+ <th>鐘舵��</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>浠茶灞傦紙arb.db锛�</td>
+ <td>SQLite WAL 妯″紡 + BEGIN IMMEDIATE 浜嬪姟 鈥� 杩涚▼闂翠徊瑁佸畬鍏ㄤ緷璧栨暟鎹簱浜嬪姟锛屾棤闇� IPC</td>
+ <td class="cell-good">鉁� 宸插疄鐜�</td>
+ </tr>
+ <tr>
+ <td>Broker 鍛戒护閫氶亾</td>
+ <td>Named Pipes 甯у崗璁紙4B 闀垮害 + JSON锛夆�� 鐢ㄤ簬瀹㈡埛绔悜 DeviceBroker.exe 涓嬪彂璁惧鎿嶄綔</td>
+ <td class="cell-neutral">鈴� 璁″垝涓紙P2+锛�</td>
+ </tr>
+ </tbody>
+ </table>
+ <p style="margin-top: 1rem; color: var(--gray-600); font-size: 0.88rem;">
+ 娉細褰撳墠 MVP 浠呭疄鐜颁簡 Local 妯″紡锛堣繘绋嬪唴鐩撮┍锛夊拰 DbLeaseStore锛圫QLite 浠茶锛夈�侭roker 妯″紡鐨勫懡浠ら�氶亾灞炰簬鍚庣画杩唬鑼冨洿锛屾鏃堕�夋嫨 Named Pipes 浣滀负 IPC 鏂规浠嶆湁鍏呭垎璋冩暣绌洪棿銆�
+ </p>
+ </div>
+
+ <footer>
+ TapProject V3.0 MVP 鈥� Broker IPC 鏂规璇勪及 | 鐢熸垚浜� 2026-11-03
+ </footer>
+
+</div>
+</body>
+</html>
--
Gitblit v1.9.1