From 5694b2635d5c0039c3c31fc4a40c3fad1d29f175 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=BD=98=E5=BB=BA=E4=B8=9C?= <617601767@qq.com>
Date: Thu, 18 Jan 2024 10:15:39 +0800
Subject: [PATCH] =?UTF-8?q?GPS=E9=80=9A=E8=AE=AF=E5=8F=82=E6=95=B0?=
=?UTF-8?q?=E5=B7=B2=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
LanSheng/LanShengModel/DeviceData.cs | 562 ++++++++++++++++++
LanSheng/LanShengService/DeviceService.cs | 14 +-
.../LanShengService/Tcp/DecoderHandler.cs | 326 +++++++---
.../LanShengService/Tcp/EncoderHandler.cs | 223 ++++++-
LanSheng/LanShengService/TcpService.cs | 77 +--
5 files changed, 1029 insertions(+), 173 deletions(-)
diff --git a/LanSheng/LanShengModel/DeviceData.cs b/LanSheng/LanShengModel/DeviceData.cs
index b34e812..63e52d0 100644
--- a/LanSheng/LanShengModel/DeviceData.cs
+++ b/LanSheng/LanShengModel/DeviceData.cs
@@ -499,33 +499,595 @@ namespace LanShengModel
[SugarColumn(IsNullable = true,IsOnlyIgnoreInsert = true,DefaultValue = "0")]
public int? RunCount { get; set; }
+ ///
+ /// 更新版本号
+ ///
[SugarColumn(IsNullable = true)]
public int? UVersion { get; set; }
+ ///
+ /// FTP地址长度
+ ///
[SugarColumn(IsNullable = true)]
public int? FtpLength { get; set; }
+ ///
+ /// FTP地址
+ ///
[SugarColumn(IsNullable = true)]
public string? FtpUrl { get; set; }
+ ///
+ /// 用户密码长度
+ ///
[SugarColumn(IsNullable = true)]
public int? UserLength { get; set; }
+ ///
+ /// 用户密码
+ ///
[SugarColumn(IsNullable = true)]
public string? UserPwd { get; set; }
+ ///
+ /// Bin地址长度
+ ///
[SugarColumn(IsNullable = true)]
public int? BinLength { get; set; }
+ ///
+ /// Bin地址
+ ///
[SugarColumn(IsNullable = true)]
public string? BinUrl { get; set; }
+ ///
+ /// Bin文件大小
+ ///
[SugarColumn(IsNullable = true)]
public int? BinSize { get; set; }
+ ///
+ /// 更新时间范围
+ ///
[SugarColumn(IsNullable = true)]
public int? UpdateSpan { get; set; }
+ ///
+ /// 外召主机通讯
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data16_B5_N { get; set; }
+
+ ///
+ /// 进料门上光电(0断开,1闭合)
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data19_B7 { get; set; }
+
+ ///
+ /// 出料门上光电(0断开,1闭合)
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data19_B6 { get; set; }
+
+ ///
+ /// 上行通道检测限位(0断开,1闭合)
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data19_B5 { get; set; }
+
+ ///
+ /// 下行通道检测限位(0断开,1闭合)
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data19_B4 { get; set; }
+
+ ///
+ /// 预留1限位(0断开,1闭合)
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data19_B3 { get; set; }
+
+ ///
+ /// 预留2限位(0断开,1闭合)
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data19_B2 { get; set; }
+
+ ///
+ /// 预留3限位(0断开,1闭合)
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data19_B1 { get; set; }
+
+ ///
+ /// 左右笼设置 0:左笼 1:右笼
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data28_B7 { get; set; }
+
+ ///
+ /// 中间B1楼层开关 0:无B1层 1:有B1层
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data28_B6 { get; set; }
+
+ ///
+ /// 中途位置丢失功能 0:不动作 1:自动到1楼
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data28_B5 { get; set; }
+
+ ///
+ /// 中途位置丢失自动到1楼高速开关 0:不使能高速 1:使能笼顶高速
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data28_B4 { get; set; }
+
+ ///
+ /// 自动下降开关 0:关闭 1:开启
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data28_B3 { get; set; }
+
+ ///
+ /// 满载直驶人数限制开关 0:关闭 1:开启
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data28_B2 { get; set; }
+
+ ///
+ /// 满载直驶重量限制开关 0:关闭 1:开启
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data28_B1 { get; set; }
+
+ ///
+ /// 货运模式开关 0:关闭 1:开启
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data28_B0 { get; set; }
+
+ ///
+ /// 预留
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data29_B7 { get; set; }
+
+ ///
+ /// 进料门光幕屏蔽 0:不屏蔽 1:屏蔽
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data29_B6 { get; set; }
+
+ ///
+ /// 出料门光幕屏蔽 0:不屏蔽 1:屏蔽
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data29_B5 { get; set; }
+
+
+ ///
+ /// 上行通道检测屏蔽 0:不屏蔽 1:屏蔽
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data29_B4 { get; set; }
+
+ ///
+ /// 下行通道检测屏蔽 0:不屏蔽 1:屏蔽
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data29_B3 { get; set; }
+
+ ///
+ /// 楼栋号
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data30 { get; set; }
+
+ ///
+ /// USR207模块信道
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data31 { get; set; }
+
+ ///
+ /// USR207模块目标地址
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data32_33 { get; set; }
+
+ ///
+ /// USR207模块速率
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data34 { get; set; }
+
+ ///
+ /// USR207模块前向纠错
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data35 { get; set; }
+
+ ///
+ /// 关门后运行等待时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data36 { get; set; }
+
+ ///
+ /// 停机后运行等待时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data37 { get; set; }
+
+ ///
+ /// 一体机开门超时时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data38_39 { get; set; }
+
+ ///
+ /// 吊笼内限制人数
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data40 { get; set; }
+
+ ///
+ /// 自动下降楼层
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data41 { get; set; }
+
+ ///
+ /// 自动下降等待时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data42_43 { get; set; }
+
+ ///
+ /// 满载直驶人数限制值
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data44 { get; set; }
+
+ ///
+ /// 满载直驶重量限制值
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data45_46 { get; set; }
+
+ ///
+ /// 自动关门延时时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data47_48 { get; set; }
+
+ ///
+ /// 延时按键延时时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data49_50 { get; set; }
+
+ ///
+ /// 进料门开门总时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data51_52 { get; set; }
+
+ ///
+ /// 进料门关门总时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data53_54 { get; set; }
+
+ ///
+ /// 出料门开门总时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data55_56 { get; set; }
+
+ ///
+ /// 出料门关门总时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data57_58 { get; set; }
+
+ ///
+ /// 进料门开门高速时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data59_60 { get; set; }
+
+ ///
+ /// 进料门关门高速时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data61_62 { get; set; }
+
+ ///
+ /// 出料门开门高速时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data63_64 { get; set; }
+
+ ///
+ /// 出料门关门高速时间
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data65_66 { get; set; }
+
+ ///
+ /// B1层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data67_B7 { get; set; }
+
+ ///
+ /// 01层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data67_B6 { get; set; }
+
+ ///
+ /// 02层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data67_B5 { get; set; }
+
+ ///
+ /// 03层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data67_B4 { get; set; }
+
+ ///
+ /// 04层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data67_B3 { get; set; }
+
+ ///
+ /// 05层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data67_B2 { get; set; }
+
+ ///
+ /// 06层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data67_B1 { get; set; }
+
+ ///
+ /// 07层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data67_B0 { get; set; }
+
+ ///
+ /// 08层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data68_B7 { get; set; }
+
+ ///
+ /// 09层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data68_B6 { get; set; }
+
+ ///
+ /// 10层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data68_B5 { get; set; }
+
+ ///
+ /// 11层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data68_B4 { get; set; }
+
+ ///
+ /// 12层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data68_B3 { get; set; }
+
+ ///
+ /// 13层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data68_B2 { get; set; }
+
+ ///
+ /// 14层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data68_B1 { get; set; }
+
+ ///
+ /// 15层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data68_B0 { get; set; }
+
+ ///
+ /// 16层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data69_B7 { get; set; }
+
+ ///
+ /// 17层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data69_B6 { get; set; }
+
+ ///
+ /// 18层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data69_B5 { get; set; }
+
+ ///
+ /// 19层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data69_B4 { get; set; }
+
+ ///
+ /// 20层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data69_B3 { get; set; }
+
+ ///
+ /// 21层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data69_B2 { get; set; }
+
+ ///
+ /// 22层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data69_B1 { get; set; }
+
+ ///
+ /// 23层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data69_B0 { get; set; }
+
+ ///
+ /// 24层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data70_B7 { get; set; }
+
+ ///
+ /// 25层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data70_B6 { get; set; }
+
+ ///
+ /// 26层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data70_B5 { get; set; }
+
+ ///
+ /// 27层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data70_B4 { get; set; }
+
+ ///
+ /// 28层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data70_B3 { get; set; }
+
+ ///
+ /// 29层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data70_B2 { get; set; }
+
+ ///
+ /// 30层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data70_B1 { get; set; }
+
+ ///
+ /// 31层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data70_B0 { get; set; }
+
+ ///
+ /// 32层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data71_B7 { get; set; }
+
+ ///
+ /// 33层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data71_B6 { get; set; }
+
+ ///
+ /// 34层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data71_B5 { get; set; }
+
+ ///
+ /// 35层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data71_B4 { get; set; }
+
+ ///
+ /// 36层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data71_B3 { get; set; }
+
+ ///
+ /// 37层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data71_B2 { get; set; }
+
+ ///
+ /// 38层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data71_B1 { get; set; }
+
+ ///
+ /// 39层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data71_B0 { get; set; }
+
+ ///
+ /// 40层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data72_B7 { get; set; }
+
+ ///
+ /// 41层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data72_B6 { get; set; }
+
+ ///
+ /// 42层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data72_B5 { get; set; }
+
+ ///
+ /// 43层有效
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int? Data72_B4 { get; set; }
+
+ ///
+ /// 恢复出厂设置
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public int? Data8_B7_1104 { get; set; }
+
#region 业务字段
[SugarColumn(IsIgnore = true)]
public string? MsgType { get; set; }
diff --git a/LanSheng/LanShengService/DeviceService.cs b/LanSheng/LanShengService/DeviceService.cs
index fcfd3d1..f95473e 100644
--- a/LanSheng/LanShengService/DeviceService.cs
+++ b/LanSheng/LanShengService/DeviceService.cs
@@ -140,8 +140,20 @@ namespace LanShengService
await temp.AsInsertable.ExecuteCommandAsync();
+ var TempType = typeof(DeviceData);
+
+ var TempPropertys = TempType.GetProperties();
+
+ var TempColumns1103 = new List();
+
+ foreach (var TempProperty in TempPropertys) {
+ if (TempProperty.GetValue(Values1103[0]) != null) {
+ TempColumns1103.Add(TempProperty.Name);
+ }
+ }
+
await temp.AsUpdateable
- .UpdateColumns(Columns1103)
+ .UpdateColumns(TempColumns1103.ToArray())
.ExecuteCommandAsync();
}
}
diff --git a/LanSheng/LanShengService/Tcp/DecoderHandler.cs b/LanSheng/LanShengService/Tcp/DecoderHandler.cs
index 0bd7227..9236e7c 100644
--- a/LanSheng/LanShengService/Tcp/DecoderHandler.cs
+++ b/LanSheng/LanShengService/Tcp/DecoderHandler.cs
@@ -9,6 +9,7 @@ using System.Text;
using System.Threading.Tasks;
using CommonExtend;
using CommonModel;
+using static Google.Rpc.Context.AttributeContext.Types;
namespace LanShengService.Tcp
{
@@ -78,83 +79,18 @@ namespace LanShengService.Tcp
request.Content.ConnectString = Content.ReadString((int)request.Content.ConnectStrLength, Encoding.ASCII);
break;
case "1103":
- request.Content.Version = Content.ReadInt(1);
- var Data2 = Content.ReadBitArray();
- request.Content.Data2_B7 = Data2[0];
- request.Content.Data2_B6 = Data2[1];
- request.Content.Data2_B5 = Data2[2];
- request.Content.Data2_B4 = Data2[3];
- request.Content.Data2_B3 = Data2[4];
- request.Content.Data2_B2 = Data2[5];
- request.Content.Data2_B1 = Data2[6];
- request.Content.Data2_B0 = Data2[7];
- var Data3 = Content.ReadBitArray();
- request.Content.Data3_B7 = Data3[0];
- request.Content.Data3_B6 = Data3[1];
- request.Content.Data3_B5 = Data3[2];
- request.Content.Data3_B4 = Data3[3];
- request.Content.Data3_B3 = Data3[4];
- request.Content.Data3_B2 = Data3[5];
- request.Content.Data3_B1 = Data3[6];
- request.Content.Data3_B0 = Data3[7];
- request.Content.Data4 = Content.ReadInt(1);
- request.Content.Data5 = Content.ReadInt(1);
- request.Content.Data6 = Content.ReadInt(1);
- request.Content.Data7 = Content.ReadInt(1);
- request.Content.Data8 = Content.ReadInt(2);
- request.Content.Data10 = Content.ReadInt(1);
- request.Content.Data11 = Content.ReadInt(1);
- request.Content.Data12 = Content.ReadInt(1);
- request.Content.Data13 = Content.ReadInt(1);
- var Data14 = Content.ReadBitArray();
- request.Content.Data14_B6 = Convert.ToInt32($"{Data14[1]}{Data14[0]}", 2);
- request.Content.Data14_B5 = Data14[2];
- request.Content.Data14_B4 = Data14[3];
- request.Content.Data14_B3 = Data14[4];
- request.Content.Data14_B2 = Data14[5];
- request.Content.Data14_B1 = Data14[6];
- request.Content.Data14_B0 = Data14[7];
- var Data15 = Content.ReadBitArray();
- request.Content.Data15_B6 = Convert.ToInt32($"{Data15[1]}{Data15[0]}", 2);
- request.Content.Data15_B4 = Convert.ToInt32($"{Data15[3]}{Data15[2]}", 2);
- request.Content.Data15_B3 = Data15[4];
- request.Content.Data15_B2 = Data15[5];
- request.Content.Data15_B1 = Data15[6];
- request.Content.Data15_B0 = Data15[7];
- var Data16 = Content.ReadBitArray();
- request.Content.Data16_B7 = Data16[0];
- request.Content.Data16_B6 = Data16[1];
- request.Content.Data16_B5 = Data16[2];
- request.Content.Data16_B4 = Data16[3];
- request.Content.Data16_B2 = Convert.ToInt32($"{Data16[5]}{Data16[4]}", 2);
- request.Content.Data16_B1 = Data16[6];
- request.Content.Data16_B0 = Data16[7];
- request.Content.Data17 = Content.ReadInt(1);
- request.Content.Data18 = Content.ReadInt(1);
- request.Content.Data19 = Content.ReadInt(1);
- request.Content.Data20 = Content.ReadInt(1);
- request.Content.Data21 = Content.ReadInt(1);
- request.Content.Data22 = Content.ReadInt(1);
- request.Content.Data23 = Content.ReadInt(1);
- request.Content.Data24 = Content.ReadInt(1);
- var Data25 = Content.ReadBitArray();
- request.Content.Data25_B4 = Convert.ToInt32($"{Data25[3]}{Data25[2]}{Data25[1]}{Data25[0]}", 2);
- request.Content.Data25_B0 = Convert.ToInt32($"{Data25[7]}{Data25[6]}{Data25[5]}{Data25[4]}", 2);
- var Data26 = Content.ReadBitArray();
- request.Content.Data26_B4 = Convert.ToInt32($"{Data26[3]}{Data26[2]}{Data26[1]}{Data26[0]}", 2);
- request.Content.Data26_B0 = Convert.ToInt32($"{Data26[7]}{Data26[6]}{Data26[5]}{Data26[4]}", 2);
- var Data27 = Content.ReadBitArray();
- request.Content.Data27_B7 = Data27[0];
- request.Content.Data27_B6 = Data27[1];
- request.Content.Data27_B5 = Data27[2];
- request.Content.Data27_B4 = Data27[3];
- request.Content.Data27_B3 = Data27[4];
- request.Content.Data27_B0 = Data27[7];
+ if (request.Content.Id.StartsWith("QC") || request.Content.Id.StartsWith("ZK"))
+ {
+ Decode1103ZK(request.Content, Content);
+ }
+ else
+ {
+ Decode1103RY(request.Content, Content);
+ }
break;
default:
break;
}
- request.Content = request.Content;
}
catch
{
@@ -174,5 +110,249 @@ namespace LanShengService.Tcp
return;
}
}
+
+ private void Decode1103RY(DeviceData device, IByteBuffer content)
+ {
+ device.Version = content.ReadInt(1);
+ var Data2 = content.ReadBitArray();
+ device.Data2_B7 = Data2[0];
+ device.Data2_B6 = Data2[1];
+ device.Data2_B5 = Data2[2];
+ device.Data2_B4 = Data2[3];
+ device.Data2_B3 = Data2[4];
+ device.Data2_B2 = Data2[5];
+ device.Data2_B1 = Data2[6];
+ device.Data2_B0 = Data2[7];
+ var Data3 = content.ReadBitArray();
+ device.Data3_B7 = Data3[0];
+ device.Data3_B6 = Data3[1];
+ device.Data3_B5 = Data3[2];
+ device.Data3_B4 = Data3[3];
+ device.Data3_B3 = Data3[4];
+ device.Data3_B2 = Data3[5];
+ device.Data3_B1 = Data3[6];
+ device.Data3_B0 = Data3[7];
+ device.Data4 = content.ReadInt(1);
+ device.Data5 = content.ReadInt(1);
+ device.Data6 = content.ReadInt(1);
+ device.Data7 = content.ReadInt(1);
+ device.Data8 = content.ReadInt(2);
+ device.Data10 = content.ReadInt(1);
+ device.Data11 = content.ReadInt(1);
+ device.Data12 = content.ReadInt(1);
+ device.Data13 = content.ReadInt(1);
+ var Data14 = content.ReadBitArray();
+ device.Data14_B6 = Convert.ToInt32($"{Data14[1]}{Data14[0]}", 2);
+ device.Data14_B5 = Data14[2];
+ device.Data14_B4 = Data14[3];
+ device.Data14_B3 = Data14[4];
+ device.Data14_B2 = Data14[5];
+ device.Data14_B1 = Data14[6];
+ device.Data14_B0 = Data14[7];
+ var Data15 = content.ReadBitArray();
+ device.Data15_B6 = Convert.ToInt32($"{Data15[1]}{Data15[0]}", 2);
+ device.Data15_B4 = Convert.ToInt32($"{Data15[3]}{Data15[2]}", 2);
+ device.Data15_B3 = Data15[4];
+ device.Data15_B2 = Data15[5];
+ device.Data15_B1 = Data15[6];
+ device.Data15_B0 = Data15[7];
+ var Data16 = content.ReadBitArray();
+ device.Data16_B7 = Data16[0];
+ device.Data16_B6 = Data16[1];
+ device.Data16_B5 = Data16[2];
+ device.Data16_B4 = Data16[3];
+ device.Data16_B2 = Convert.ToInt32($"{Data16[5]}{Data16[4]}", 2);
+ device.Data16_B1 = Data16[6];
+ device.Data16_B0 = Data16[7];
+ device.Data17 = content.ReadInt(1);
+ device.Data18 = content.ReadInt(1);
+ device.Data19 = content.ReadInt(1);
+ device.Data20 = content.ReadInt(1);
+ device.Data21 = content.ReadInt(1);
+ device.Data22 = content.ReadInt(1);
+ device.Data23 = content.ReadInt(1);
+ device.Data24 = content.ReadInt(1);
+ var Data25 = content.ReadBitArray();
+ device.Data25_B4 = Convert.ToInt32($"{Data25[3]}{Data25[2]}{Data25[1]}{Data25[0]}", 2);
+ device.Data25_B0 = Convert.ToInt32($"{Data25[7]}{Data25[6]}{Data25[5]}{Data25[4]}", 2);
+ var Data26 = content.ReadBitArray();
+ device.Data26_B4 = Convert.ToInt32($"{Data26[3]}{Data26[2]}{Data26[1]}{Data26[0]}", 2);
+ device.Data26_B0 = Convert.ToInt32($"{Data26[7]}{Data26[6]}{Data26[5]}{Data26[4]}", 2);
+ var Data27 = content.ReadBitArray();
+ device.Data27_B7 = Data27[0];
+ device.Data27_B6 = Data27[1];
+ device.Data27_B5 = Data27[2];
+ device.Data27_B4 = Data27[3];
+ device.Data27_B3 = Data27[4];
+ device.Data27_B0 = Data27[7];
+ }
+
+ private void Decode1103ZK(DeviceData device, IByteBuffer content) {
+ device.Version = content.ReadInt(1);
+ var Data2 = content.ReadBitArray();
+ device.Data2_B7 = Data2[0];
+ device.Data2_B6 = Data2[1];
+ device.Data2_B5 = Data2[2];
+ device.Data2_B4 = Data2[3];
+ device.Data2_B3 = Data2[4];
+ device.Data2_B2 = Data2[5];
+ device.Data2_B1 = Data2[6];
+ device.Data2_B0 = Data2[7];
+ var Data3 = content.ReadBitArray();
+ device.Data3_B7 = Data3[0];
+ device.Data3_B6 = Data3[1];
+ device.Data3_B5 = Data3[2];
+ device.Data3_B4 = Data3[3];
+ device.Data3_B3 = Data3[4];
+ device.Data3_B2 = Data3[5];
+ device.Data3_B1 = Data3[6];
+ device.Data3_B0 = Data3[7];
+ device.Data4 = content.ReadInt(1);
+ device.Data5 = content.ReadInt(1);
+ device.Data6 = content.ReadInt(1);
+ device.Data7 = content.ReadInt(1);
+ device.Data8 = content.ReadInt(2);
+ device.Data10 = content.ReadInt(1);
+ device.Data11 = content.ReadInt(1);
+ device.Data12 = content.ReadInt(1);
+ content.SkipBytes(1);
+ var Data14 = content.ReadBitArray();
+ device.Data14_B6 = Convert.ToInt32($"{Data14[1]}{Data14[0]}", 2);
+ device.Data14_B5 = Data14[2];
+ device.Data14_B4 = Data14[3];
+ device.Data14_B3 = Data14[4];
+ device.Data14_B2 = Data14[5];
+ device.Data14_B1 = Data14[6];
+ device.Data14_B0 = Data14[7];
+ var Data15 = content.ReadBitArray();
+ device.Data15_B6 = Convert.ToInt32($"{Data15[1]}{Data15[0]}", 2);
+ device.Data15_B4 = Convert.ToInt32($"{Data15[3]}{Data15[2]}", 2);
+ device.Data15_B3 = Data15[4];
+ device.Data15_B2 = Data15[5];
+ device.Data15_B1 = Data15[6];
+ device.Data15_B0 = Data15[7];
+ var Data16 = content.ReadBitArray();
+ device.Data16_B7 = Data16[0];
+ device.Data16_B6 = Data16[1];
+ device.Data16_B5_N = Data16[2];
+ device.Data16_B4 = Data16[3];
+ device.Data16_B2 = Convert.ToInt32($"{Data16[5]}{Data16[4]}", 2);
+ device.Data16_B1 = Data16[6];
+ device.Data16_B0 = Data16[7];
+ device.Data17 = content.ReadInt(1);
+ device.Data18 = content.ReadInt(1);
+ var Data19 = content.ReadBitArray();
+ device.Data19_B7 = Data19[0];
+ device.Data19_B6 = Data19[1];
+ device.Data19_B5 = Data19[2];
+ device.Data19_B4 = Data19[3];
+ device.Data19_B3 = Data19[4];
+ device.Data19_B2 = Data19[5];
+ device.Data19_B1 = Data19[6];
+ device.Data20 = content.ReadInt(1);
+ device.Data21 = content.ReadInt(1);
+ device.Data22 = content.ReadInt(1);
+ device.Data23 = content.ReadInt(1);
+ device.Data24 = content.ReadInt(1);
+ var Data25 = content.ReadBitArray();
+ device.Data25_B4 = Convert.ToInt32($"{Data25[3]}{Data25[2]}{Data25[1]}{Data25[0]}", 2);
+ device.Data25_B0 = Convert.ToInt32($"{Data25[7]}{Data25[6]}{Data25[5]}{Data25[4]}", 2);
+ var Data26 = content.ReadBitArray();
+ device.Data26_B4 = Convert.ToInt32($"{Data26[3]}{Data26[2]}{Data26[1]}{Data26[0]}", 2);
+ device.Data26_B0 = Convert.ToInt32($"{Data26[7]}{Data26[6]}{Data26[5]}{Data26[4]}", 2);
+ var Data27 = content.ReadBitArray();
+ device.Data27_B7 = Data27[0];
+ device.Data27_B6 = Data27[1];
+ device.Data27_B5 = Data27[2];
+ device.Data27_B4 = Data27[3];
+ device.Data27_B3 = Data27[4];
+ var Data28 = content.ReadBitArray();
+ device.Data28_B7 = Data28[0];
+ device.Data28_B6 = Data28[1];
+ device.Data28_B5 = Data28[2];
+ device.Data28_B4 = Data28[3];
+ device.Data28_B3 = Data28[4];
+ device.Data28_B2 = Data28[5];
+ device.Data28_B1 = Data28[6];
+ device.Data28_B0 = Data28[7];
+ var Data29 = content.ReadBitArray();
+ device.Data29_B6 = Data29[1];
+ device.Data29_B5 = Data29[2];
+ device.Data29_B4 = Data29[3];
+ device.Data29_B3 = Data29[4];
+ device.Data30 = content.ReadInt(1);
+ device.Data31 = content.ReadInt(1);
+ device.Data32_33 = content.ReadInt(2);
+ device.Data34 = content.ReadInt(1);
+ device.Data35 = content.ReadInt(1);
+ device.Data36 = content.ReadInt(1);
+ device.Data37 = content.ReadInt(1);
+ device.Data38_39 = content.ReadInt(2);
+ device.Data40 = content.ReadInt(1);
+ device.Data41 = content.ReadInt(1);
+ device.Data42_43 = content.ReadInt(2);
+ device.Data44 = content.ReadInt(1);
+ device.Data45_46 = content.ReadInt(2);
+ device.Data47_48 = content.ReadInt(2);
+ device.Data49_50 = content.ReadInt(2);
+ device.Data51_52 = content.ReadInt(2);
+ device.Data53_54 = content.ReadInt(2);
+ device.Data55_56 = content.ReadInt(2);
+ device.Data57_58 = content.ReadInt(2);
+ device.Data59_60 = content.ReadInt(2);
+ device.Data61_62 = content.ReadInt(2);
+ device.Data63_64 = content.ReadInt(2);
+ device.Data65_66 = content.ReadInt(2);
+ var Data67 = content.ReadBitArray();
+ device.Data67_B7 = Data67[0];
+ device.Data67_B6 = Data67[1];
+ device.Data67_B5 = Data67[2];
+ device.Data67_B4 = Data67[3];
+ device.Data67_B3 = Data67[4];
+ device.Data67_B2 = Data67[5];
+ device.Data67_B1 = Data67[6];
+ device.Data67_B0 = Data67[7];
+ var Data68 = content.ReadBitArray();
+ device.Data68_B7 = Data68[0];
+ device.Data68_B6 = Data68[1];
+ device.Data68_B5 = Data68[2];
+ device.Data68_B4 = Data68[3];
+ device.Data68_B3 = Data68[4];
+ device.Data68_B2 = Data68[5];
+ device.Data68_B1 = Data68[6];
+ device.Data68_B0 = Data68[7];
+ var Data69 = content.ReadBitArray();
+ device.Data69_B7 = Data69[0];
+ device.Data69_B6 = Data69[1];
+ device.Data69_B5 = Data69[2];
+ device.Data69_B4 = Data69[3];
+ device.Data69_B3 = Data69[4];
+ device.Data69_B2 = Data69[5];
+ device.Data69_B1 = Data69[6];
+ device.Data69_B0 = Data69[7];
+ var Data70 = content.ReadBitArray();
+ device.Data70_B7 = Data70[0];
+ device.Data70_B6 = Data70[1];
+ device.Data70_B5 = Data70[2];
+ device.Data70_B4 = Data70[3];
+ device.Data70_B3 = Data70[4];
+ device.Data70_B2 = Data70[5];
+ device.Data70_B1 = Data70[6];
+ device.Data70_B0 = Data70[7];
+ var Data71 = content.ReadBitArray();
+ device.Data71_B7 = Data71[0];
+ device.Data71_B6 = Data71[1];
+ device.Data71_B5 = Data71[2];
+ device.Data71_B4 = Data71[3];
+ device.Data71_B3 = Data71[4];
+ device.Data71_B2 = Data71[5];
+ device.Data71_B1 = Data71[6];
+ device.Data71_B0 = Data71[7];
+ var Data72 = content.ReadBitArray();
+ device.Data72_B7 = Data72[0];
+ device.Data72_B6 = Data72[1];
+ device.Data72_B5 = Data72[2];
+ device.Data72_B4 = Data72[3];
+ }
}
}
diff --git a/LanSheng/LanShengService/Tcp/EncoderHandler.cs b/LanSheng/LanShengService/Tcp/EncoderHandler.cs
index ca3311f..612406e 100644
--- a/LanSheng/LanShengService/Tcp/EncoderHandler.cs
+++ b/LanSheng/LanShengService/Tcp/EncoderHandler.cs
@@ -24,39 +24,13 @@ namespace LanShengService.Tcp
switch (message.Msg_ID)
{
case "1104":
- Temp.AddRange(((int)message.Content!.Version!).Int2Byte().BytePadLeft(1));
- Temp.AddRange(((int)message.Content!.DataTick!).Int2Byte().BytePadLeft(2));
- int[] Data1 = new int[] {
- (int)message.Content!.Data27_B7!,
- (int)message.Content!.Data27_B6!,
- (int)message.Content!.Data27_B5!,
- (int)message.Content!.Data27_B4!,
- (int)message.Content!.Data27_B3!,
- 0,
- 0,
- (int)message.Content!.Data27_B0!,
- };
- Temp.AddRange(Data1.BitArray2Byte());
- int[] Data2 = new int[] {
- (int)message.Content!.Data23!,
- (int)message.Content!.Data20!,
- (int)message.Content!.Data19!,
- (int)message.Content!.Data18!,
- ((int)message.Content!.Data16_B2!).Int2Bit(2)[1],
- ((int)message.Content!.Data16_B2!).Int2Bit(2)[0],
- 0,
- 0
- };
- Temp.AddRange(Data2.BitArray2Byte());
- Temp.AddRange(((int)message.Content.Data25_B4!).Int2Byte().BytePadLeft(1));
- Temp.AddRange(((int)message.Content.Data25_B0!).Int2Byte().BytePadLeft(1));
- Temp.AddRange(((int)message.Content.Data26_B4!).Int2Byte().BytePadLeft(1));
- Temp.AddRange(((int)message.Content.Data26_B0!).Int2Byte().BytePadLeft(1));
- Temp.AddRange(((int)message.Content.UpdateTag!).Int2Byte().BytePadLeft(1));
- var ConnectByte = Encoding.ASCII.GetBytes(message.Content.ConnectString!);
- message.Content.ConnectStrLength = message.Content.ConnectString!.Length;
- Temp.AddRange(((int)message.Content.ConnectStrLength!).Int2Byte().BytePadLeft(1));
- Temp.AddRange(ConnectByte);
+ if (message.Content!.Id!.StartsWith("QC") || message.Content!.Id!.StartsWith("ZK"))
+ {
+ Encode1104ZK(Temp, message.Content!);
+ }
+ else {
+ Encode1104RY(Temp,message.Content!);
+ }
break;
case "1107":
Temp.AddRange(((int)message.Content!.UVersion!).Int2Byte().BytePadLeft(2));
@@ -85,5 +59,188 @@ namespace LanShengService.Tcp
Temp.AddRange(message.Frame_END!.HexString2Byte().BytePadLeft(2));
output.WriteBytes(Temp.ToArray());
}
+
+ private void Encode1104RY(List bytes,DeviceData device) {
+ bytes.AddRange(((int)device.Version!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.DataTick!).Int2Byte().BytePadLeft(2));
+ int[] Data1 = new int[] {
+ (int)device.Data27_B7!,
+ (int)device.Data27_B6!,
+ (int)device.Data27_B5!,
+ (int)device.Data27_B4!,
+ (int)device.Data27_B3!,
+ 0,
+ 0,
+ (int)device.Data27_B0!,
+ };
+ bytes.AddRange(Data1.BitArray2Byte());
+ int[] Data2 = new int[] {
+ (int)device.Data23!,
+ (int)device.Data20!,
+ (int)device.Data19!,
+ (int)device.Data18!,
+ ((int)device.Data16_B2!).Int2Bit(2)[1],
+ ((int)device.Data16_B2!).Int2Bit(2)[0],
+ 0,
+ 0
+ };
+ bytes.AddRange(Data2.BitArray2Byte());
+ bytes.AddRange(((int)device.Data25_B4!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data25_B0!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data26_B4!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data26_B0!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.UpdateTag!).Int2Byte().BytePadLeft(1));
+ var ConnectByte = Encoding.ASCII.GetBytes(device.ConnectString!);
+ device.ConnectStrLength = device.ConnectString!.Length;
+ bytes.AddRange(((int)device.ConnectStrLength!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(ConnectByte);
+ }
+
+ private void Encode1104ZK(List bytes, DeviceData device)
+ {
+ bytes.AddRange(((int)device.Version!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.DataTick!).Int2Byte().BytePadLeft(2));
+ int[] Data1 = new int[] {
+ (int)device.Data27_B7!,
+ (int)device.Data27_B6!,
+ (int)device.Data27_B5!,
+ (int)device.Data27_B4!,
+ (int)device.Data27_B3!,
+ 0,
+ 0,
+ 0
+ };
+ bytes.AddRange(Data1.BitArray2Byte());
+ int[] Data2 = new int[] {
+ (int)device.Data23!,
+ 0,
+ ((int)device.Data18!).Int2Bit(2)[1],
+ ((int)device.Data18!).Int2Bit(2)[0],
+ ((int)device.Data16_B2!).Int2Bit(2)[1],
+ ((int)device.Data16_B2!).Int2Bit(2)[0],
+ 0,
+ 0
+ };
+ bytes.AddRange(Data2.BitArray2Byte());
+ bytes.AddRange(((int)device.Data25_B4!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data25_B0!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data26_B4!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data26_B0!).Int2Byte().BytePadLeft(1));
+ int[] Data7 = new int[] {
+ (int)device.Data28_B7!,
+ (int)device.Data28_B6!,
+ (int)device.Data28_B5!,
+ (int)device.Data28_B4!,
+ (int)device.Data28_B3!,
+ (int)device.Data28_B2!,
+ (int)device.Data28_B1!,
+ (int)device.Data28_B0!
+ };
+ bytes.AddRange(Data7.BitArray2Byte());
+ int[] Data8 = new int[] {
+ (int)device.Data8_B7_1104!,
+ (int)device.Data29_B6!,
+ (int)device.Data29_B5!,
+ (int)device.Data29_B4!,
+ (int)device.Data29_B3!,
+ 0,
+ 0,
+ 0
+ };
+ bytes.AddRange(Data8.BitArray2Byte());
+ bytes.AddRange(((int)device.Data30!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data31!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data32_33!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data34!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data35!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data36!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data37!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data38_39!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data40!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data41!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data42_43!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data44!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(((int)device.Data45_46!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data47_48!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data49_50!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data51_52!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data53_54!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data55_56!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data57_58!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data59_60!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data61_62!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data63_64!).Int2Byte().BytePadLeft(2));
+ bytes.AddRange(((int)device.Data65_66!).Int2Byte().BytePadLeft(2));
+ int[] Data32 = new int[] {
+ (int)device.Data67_B7!,
+ (int)device.Data67_B6!,
+ (int)device.Data67_B5!,
+ (int)device.Data67_B4!,
+ (int)device.Data67_B3!,
+ (int)device.Data67_B2!,
+ (int)device.Data67_B1!,
+ (int)device.Data67_B0!
+ };
+ bytes.AddRange(Data32.BitArray2Byte());
+ int[] Data33 = new int[] {
+ (int)device.Data68_B7!,
+ (int)device.Data68_B6!,
+ (int)device.Data68_B5!,
+ (int)device.Data68_B4!,
+ (int)device.Data68_B3!,
+ (int)device.Data68_B2!,
+ (int)device.Data68_B1!,
+ (int)device.Data68_B0!
+ };
+ bytes.AddRange(Data33.BitArray2Byte());
+ int[] Data34 = new int[] {
+ (int)device.Data69_B7!,
+ (int)device.Data69_B6!,
+ (int)device.Data69_B5!,
+ (int)device.Data69_B4!,
+ (int)device.Data69_B3!,
+ (int)device.Data69_B2!,
+ (int)device.Data69_B1!,
+ (int)device.Data69_B0!
+ };
+ bytes.AddRange(Data34.BitArray2Byte());
+ int[] Data35 = new int[] {
+ (int)device.Data70_B7!,
+ (int)device.Data70_B6!,
+ (int)device.Data70_B5!,
+ (int)device.Data70_B4!,
+ (int)device.Data70_B3!,
+ (int)device.Data70_B2!,
+ (int)device.Data70_B1!,
+ (int)device.Data70_B0!
+ };
+ bytes.AddRange(Data35.BitArray2Byte());
+ int[] Data36 = new int[] {
+ (int)device.Data71_B7!,
+ (int)device.Data71_B6!,
+ (int)device.Data71_B5!,
+ (int)device.Data71_B4!,
+ (int)device.Data71_B3!,
+ (int)device.Data71_B2!,
+ (int)device.Data71_B1!,
+ (int)device.Data71_B0!
+ };
+ bytes.AddRange(Data36.BitArray2Byte());
+ int[] Data37 = new int[] {
+ (int)device.Data72_B7!,
+ (int)device.Data72_B6!,
+ (int)device.Data72_B5!,
+ (int)device.Data72_B4!,
+ 0,
+ 0,
+ 0,
+ 0
+ };
+ bytes.AddRange(Data37.BitArray2Byte());
+ var ConnectByte = Encoding.ASCII.GetBytes(device.ConnectString!);
+ device.ConnectStrLength = device.ConnectString!.Length;
+ bytes.AddRange(((int)device.ConnectStrLength!).Int2Byte().BytePadLeft(1));
+ bytes.AddRange(ConnectByte);
+ }
}
}
diff --git a/LanSheng/LanShengService/TcpService.cs b/LanSheng/LanShengService/TcpService.cs
index 186e98f..58a9221 100644
--- a/LanSheng/LanShengService/TcpService.cs
+++ b/LanSheng/LanShengService/TcpService.cs
@@ -26,6 +26,7 @@ using DotNetty.Transport.Channels.Groups;
using CommonModel;
using DotNetty.Handlers.Timeout;
using System.Diagnostics;
+using System.Reflection;
namespace LanShengService
{
@@ -231,34 +232,8 @@ namespace LanShengService
{
var oldData = Db.Queryable().Where(x => x.Id == deviceData.Id).First();
- if (deviceData.Version == null)
- {
- deviceData.Version = oldData.Version;
- }
- if (deviceData.DataTick == null)
- {
- deviceData.DataTick = oldData.DataTick;
- }
- if (deviceData.Data27_B7 == null)
- {
- deviceData.Data27_B7 = oldData.Data27_B7;
- }
- if (deviceData.Data27_B6 == null)
- {
- deviceData.Data27_B6 = oldData.Data27_B6;
- }
- if (deviceData.Data27_B5 == null)
- {
- deviceData.Data27_B5 = oldData.Data27_B5;
- }
- if (deviceData.Data27_B4 == null)
- {
- deviceData.Data27_B4 = oldData.Data27_B4;
- }
- if (deviceData.Data27_B3 == null)
- {
- deviceData.Data27_B3 = oldData.Data27_B3;
- }
+ Type TempType = typeof(DeviceData);
+ PropertyInfo[] TempPropertys = TempType.GetProperties();
if (deviceData.ConnectString != null && deviceData.ConnectString != oldData.ConnectString)
{
deviceData.Data27_B0 = 1;
@@ -267,50 +242,20 @@ namespace LanShengService
{
deviceData.Data27_B0 = 0;
}
- if (deviceData.Data23 == null)
- {
- deviceData.Data23 = oldData.Data23;
- }
- if (deviceData.Data20 == null)
- {
- deviceData.Data20 = oldData.Data20;
- }
- if (deviceData.Data19 == null)
- {
- deviceData.Data19 = oldData.Data19;
- }
- if (deviceData.Data18 == null)
- {
- deviceData.Data18 = oldData.Data18;
- }
- if (deviceData.Data16_B2 == null)
- {
- deviceData.Data16_B2 = oldData.Data16_B2;
- }
- if (deviceData.Data25_B4 == null)
- {
- deviceData.Data25_B4 = oldData.Data25_B4;
- }
- if (deviceData.Data25_B0 == null)
- {
- deviceData.Data25_B0 = oldData.Data25_B0;
- }
- if (deviceData.Data26_B4 == null)
- {
- deviceData.Data26_B4 = oldData.Data26_B4;
- }
- if (deviceData.Data26_B0 == null)
- {
- deviceData.Data26_B0 = oldData.Data26_B0;
- }
if (deviceData.UpdateTag == null)
{
deviceData.UpdateTag = 0;
}
- if (deviceData.ConnectString == null)
+ if (deviceData.Data8_B7_1104 == null) {
+ deviceData.Data8_B7_1104 = 0;
+ }
+ foreach (PropertyInfo propertyInfo in TempPropertys)
{
- deviceData.ConnectString = oldData.ConnectString;
+ if (propertyInfo.GetValue(deviceData) == null) {
+ propertyInfo.SetValue(deviceData, propertyInfo.GetValue(oldData));
+ }
}
+
return Task.CompletedTask;
}