From d1b72117058f1131046b6aa3add8e3ccfae033d8 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 09 十一月 2026 10:36:07 +0800
Subject: [PATCH] docs: CAN 模拟器独立 TCP 服务进程设计规格(统一 CanDeviceDriver + 双工推送协议)

---
 ModBusTcpController/ModBusTcpController.cs |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/ModBusTcpController/ModBusTcpController.cs b/ModBusTcpController/ModBusTcpController.cs
index e431966..835e542 100644
--- a/ModBusTcpController/ModBusTcpController.cs
+++ b/ModBusTcpController/ModBusTcpController.cs
@@ -48,23 +48,39 @@
             return res?.IsSuccess == true;
         }
 
-        public bool ReadDIInt(string address, out int res, out string msg)
+        public bool ReadDIInt16(string address, out int res, out string msg)
         {
-            var result = client?.ReadInt32($"x=2;{address}");
+            var result = client?.ReadInt16($"x=2;{address}");
             msg = result?.Message;
             res = result?.Content ?? 0;
             return result?.IsSuccess == true;
         }
 
-        public bool ReadDOInt(string address, out int res, out string msg)
+        public bool ReadDOInt16(string address, out int res, out string msg)
         {
-            var result = client?.ReadInt32(address);
+            var result = client?.ReadInt16(address);
             msg = result?.Message;
             res = result?.Content ?? 0;
             return result?.IsSuccess == true;
         }
 
-        public bool WriteInt(string address, int value, out string msg)
+        public bool WriteInt16(string address, short value, out string msg)
+        {
+            msg = string.Empty;
+            var res = client?.Write(address, value);
+            msg = res.Message;
+            return res?.IsSuccess == true;
+        }
+
+        public bool ReadUInt16(string address, out ushort res, out string msg)
+        {
+            var result = client?.ReadUInt16(address);
+            msg = result?.Message;
+            res = result?.Content ?? 0;
+            return result?.IsSuccess == true;
+        }
+
+        public bool WriteUInt16(string address, ushort value, out string msg)
         {
             msg = string.Empty;
             var res = client?.Write(address, value);

--
Gitblit v1.9.1