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&nbsp;&nbsp;vs&nbsp;&nbsp;COM Interop&nbsp;&nbsp;|&nbsp;&nbsp;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 鏂规璇勪及 &nbsp;|&nbsp; 鐢熸垚浜� 2026-11-03
+    </footer>
+
+</div>
+</body>
+</html>

--
Gitblit v1.9.1