From e6a26ee148587327478d9a82624a820c907b6e16 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 04 十一月 2020 14:58:15 +0800
Subject: [PATCH] 20201104

---
 HDL_ON/DriverLayer/Target.cs |   62 +++++++++++++------------------
 1 files changed, 26 insertions(+), 36 deletions(-)

diff --git a/HDL_ON/DriverLayer/Target.cs b/HDL_ON/DriverLayer/Target.cs
index 5f2c41f..6c7a044 100644
--- a/HDL_ON/DriverLayer/Target.cs
+++ b/HDL_ON/DriverLayer/Target.cs
@@ -6,14 +6,18 @@
 namespace HDL_ON
 {
     /// <summary>
-    /// 控制目标数据
+    /// 鎺у埗鏁版嵁
     /// </summary>
     public class Target
     {
         /// <summary>
-        /// 发送的目标
+        /// 鐩爣绔彛
         /// </summary>
         public System.Net.IPEndPoint IPEndPoint;
+        /// <summary>
+        /// 鏈満璁惧绫诲瀷
+        /// </summary>
+        int deviceType = 58037;
 
         public Target()
         { }
@@ -24,26 +28,24 @@
         }
 
         /// <summary>
-        /// 附加数据
+        /// 闄勫姞鏁版嵁
         /// </summary>
         public byte[] AddData;
 
         /// <summary>
-        /// 目标子网号
+        /// 鐩爣瀛愮綉鍙�
         /// </summary>
         public byte SubnetID;
 
         /// <summary>
-        /// 目标设备号
+        /// 鐩爣璁惧鍙�
         /// </summary>
         public byte DeviceID;
 
-        /// <summary>
-        /// 发送数据缓冲区
-        /// </summary>
+        public byte[] GetGatewayIp_SendBytes;
+
         public byte [] SendBytes {
             get {
-
                 if (2 + 9 + AddData.Length + 2 <= 81&&Command!=Command.SuperGatewayAgent) {
                     byte [] bytes = new byte [16 + 9 + AddData.Length + 2];
 
@@ -64,27 +66,22 @@
                     bytes [11] = (byte)'C';//C
                     bytes [12] = (byte)'L';//L
                     bytes [13] = (byte)'E';//E
-                                           //引导码2位,0xAAAA固定
+                                           
                     bytes [14] = 0xAA;
                     bytes [15] = 0xAA;
 
-                    bytes [16] = (byte)(11 + AddData.Length);//数据包长度
-                    bytes [17] = 252; //源子网地址 0-254
-                    bytes [18] = 252;//源设备地址 0-254
-                                                      //源设备类型2位
-                    bytes [19] = (byte)(0xFF);
-                    bytes [20] = (byte)(0xFC);
-                    //操作码
+                    bytes [16] = (byte)(11 + AddData.Length);
+                    bytes [17] = 252; //婧愬瓙缃戝彿
+                    bytes [18] = 252; //婧愯澶囧彿
+                    bytes [19] = (byte)(deviceType/256);
+                    bytes [20] = (byte)(deviceType%256);
                     bytes [21] = (byte)((int)this.Command / 256);
                     bytes [22] = (byte)((int)this.Command % 256);
-                    //目标子网地址 0-254
-                    bytes [23] = this.SubnetID;
-                    //目标设备地址 0-254
-                    bytes [24] = this.DeviceID;
+                    bytes [23] = this.SubnetID;//鐩爣瀛愮綉鍙�
+                    bytes [24] = this.DeviceID;//鐩爣璁惧鍙�
 
                     Array.Copy (AddData, 0, bytes, 25, AddData.Length);
-
-                    //CRC校验位
+                    //CRC鏍¢獙浣�
                     bytes [bytes.Length - 2] = 0;
                     bytes [bytes.Length - 1] = 0;
 
@@ -112,22 +109,17 @@
                     bytes [11] = (byte)'C';//C
                     bytes [12] = (byte)'L';//L
                     bytes [13] = (byte)'E';//E
-                                           //引导码2位,0xAAAA固定
                     bytes [14] = 0xAA;
                     bytes [15] = 0xAA;
 
-                    bytes [16] = 0xFF;//数据包长度
-                    bytes [17] = 252; //源子网地址 0-254
-                    bytes [18] = 252;//源设备地址 0-254
-                                                      //源设备类型2位
-                    bytes [19] = (byte)(0xFF);
-                    bytes [20] = (byte)(0xFC);
-                    //操作码
+                    bytes [16] = 0xFF;//鏁版嵁鍖呴暱搴�
+                    bytes [17] = 252;//婧愬瓙缃戝彿
+                    bytes [18] = 252;//婧愯澶囧彿
+                    bytes [19] = (byte)(deviceType/256);
+                    bytes [20] = (byte)(deviceType%256);
                     bytes [21] = (byte)((int)this.Command / 256);
                     bytes [22] = (byte)((int)this.Command % 256);
-                    //目标子网地址 0-254
                     bytes [23] = this.SubnetID;
-                    //目标设备地址 0-254
                     bytes [24] = this.DeviceID;
 
                     //
@@ -141,11 +133,9 @@
                 }
             }
         }
-
         /// <summary>
-        /// 操作码
+        /// 鎿嶄綔鐮�
         /// </summary>
         public Command Command;
-
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0