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 | 64 +++++++++++++------------------
1 files changed, 27 insertions(+), 37 deletions(-)
diff --git a/HDL_ON/DriverLayer/Target.cs b/HDL_ON/DriverLayer/Target.cs
index 9e47bdf..6c7a044 100644
--- a/HDL_ON/DriverLayer/Target.cs
+++ b/HDL_ON/DriverLayer/Target.cs
@@ -1,19 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
-using HDL_ON.Entity.Enumerative;
+using HDL_ON.Entity;
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