From 611786df5108dca0bdcff03834cc285cba4b8e61 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 13 十月 2020 16:48:43 +0800 Subject: [PATCH] 2020-10-13-1 --- HDL_ON/DriverLayer/Target.cs | 36 ++++++++++++++++++++++++++++++------ 1 files changed, 30 insertions(+), 6 deletions(-) diff --git a/HDL_ON/DriverLayer/Target.cs b/HDL_ON/DriverLayer/Target.cs index 9e47bdf..c7ae958 100644 --- a/HDL_ON/DriverLayer/Target.cs +++ b/HDL_ON/DriverLayer/Target.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Text; -using HDL_ON.Entity.Enumerative; +using HDL_ON.Entity; namespace HDL_ON { @@ -14,6 +14,10 @@ /// 发送的目标 /// </summary> public System.Net.IPEndPoint IPEndPoint; + /// <summary> + /// 设备类型 + /// </summary> + int deviceType = 58037; public Target() { } @@ -38,12 +42,18 @@ /// </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]; @@ -72,8 +82,8 @@ bytes [17] = 252; //源子网地址 0-254 bytes [18] = 252;//源设备地址 0-254 //源设备类型2位 - bytes [19] = (byte)(0xFF); - bytes [20] = (byte)(0xFC); + bytes [19] = (byte)(deviceType/256); + bytes [20] = (byte)(deviceType%256); //操作码 bytes [21] = (byte)((int)this.Command / 256); bytes [22] = (byte)((int)this.Command % 256); @@ -120,8 +130,8 @@ bytes [17] = 252; //源子网地址 0-254 bytes [18] = 252;//源设备地址 0-254 //源设备类型2位 - bytes [19] = (byte)(0xFF); - bytes [20] = (byte)(0xFC); + bytes [19] = (byte)(deviceType/256); + bytes [20] = (byte)(deviceType%256); //操作码 bytes [21] = (byte)((int)this.Command / 256); bytes [22] = (byte)((int)this.Command % 256); @@ -147,5 +157,19 @@ /// </summary> public Command Command; + + + /// <summary> + /// 发送数据缓冲区 + /// </summary> + public byte[] SendBytesGetGatewayIP + { + get + { + return AddData; + } + } + + } } \ No newline at end of file -- Gitblit v1.8.0