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 | 68 ++++++++------------------------- 1 files changed, 17 insertions(+), 51 deletions(-) diff --git a/HDL_ON/DriverLayer/Target.cs b/HDL_ON/DriverLayer/Target.cs index c7ae958..6c7a044 100644 --- a/HDL_ON/DriverLayer/Target.cs +++ b/HDL_ON/DriverLayer/Target.cs @@ -6,16 +6,16 @@ namespace HDL_ON { /// <summary> - /// 控制目标数据 + /// 鎺у埗鏁版嵁 /// </summary> public class Target { /// <summary> - /// 发送的目标 + /// 鐩爣绔彛 /// </summary> public System.Net.IPEndPoint IPEndPoint; /// <summary> - /// 设备类型 + /// 鏈満璁惧绫诲瀷 /// </summary> int deviceType = 58037; @@ -28,32 +28,24 @@ } /// <summary> - /// 附加数据 + /// 闄勫姞鏁版嵁 /// </summary> public byte[] AddData; /// <summary> - /// 目标子网号 + /// 鐩爣瀛愮綉鍙� /// </summary> public byte SubnetID; /// <summary> - /// 目标设备号 + /// 鐩爣璁惧鍙� /// </summary> public byte DeviceID; public byte[] GetGatewayIp_SendBytes; - /// <summary> - /// 发送数据缓冲区 - /// </summary> public byte [] SendBytes { get { - if(GetGatewayIp_SendBytes!=null) - { - byte[] bytes = GetGatewayIp_SendBytes; - return bytes; - } if (2 + 9 + AddData.Length + 2 <= 81&&Command!=Command.SuperGatewayAgent) { byte [] bytes = new byte [16 + 9 + AddData.Length + 2]; @@ -74,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 [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; @@ -122,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 [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; // @@ -151,25 +133,9 @@ } } } - /// <summary> - /// 操作码 + /// 鎿嶄綔鐮� /// </summary> public Command Command; - - - - /// <summary> - /// 发送数据缓冲区 - /// </summary> - public byte[] SendBytesGetGatewayIP - { - get - { - return AddData; - } - } - - } } \ No newline at end of file -- Gitblit v1.8.0