From a715181089be0d31cd737a5367ffd02690b9d77f Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 12 十一月 2020 13:36:01 +0800 Subject: [PATCH] 20201112 --- HDL_ON/DriverLayer/Target.cs | 52 +++++++++++++++++++--------------------------------- 1 files changed, 19 insertions(+), 33 deletions(-) diff --git a/HDL_ON/DriverLayer/Target.cs b/HDL_ON/DriverLayer/Target.cs index f374e38..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,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]; @@ -68,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; @@ -116,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; // @@ -145,11 +133,9 @@ } } } - /// <summary> - /// 操作码 + /// 鎿嶄綔鐮� /// </summary> public Command Command; - } } \ No newline at end of file -- Gitblit v1.8.0