From 9c8baf7e7e1169ebdf7d5f7ed33ab29dd5fcbf18 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 14 十二月 2020 17:45:17 +0800
Subject: [PATCH] 2020-12-14 1.解锁设置问题修复,增加面容ID验证。2.错误码对接增加。

---
 HDL_ON/DAL/DriverLayer/Packet.cs |   36 +++++++++++++++++++-----------------
 1 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs
index 6fce368..78c1cd2 100644
--- a/HDL_ON/DAL/DriverLayer/Packet.cs
+++ b/HDL_ON/DAL/DriverLayer/Packet.cs
@@ -116,8 +116,8 @@
                 {
                     case Command.SetSingleLightACK:
                         var queryList = new List<Function>();
-                        queryList.AddRange(DB_ResidenceData.functionList.electricals);
-                        queryList.AddRange(DB_ResidenceData.functionList.lights);
+                        queryList.AddRange(FunctionList.List.electricals);
+                        queryList.AddRange(FunctionList.List.lights);
                         foreach (var updataObj in queryList)
                         {
                             if (updataObj.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
@@ -163,12 +163,12 @@
                     case Command.ReadLightAllLoopBrightnessACK:
                         for (int i = 0; i < receiveBytes[0]; i++)
                         {
-                            var light = DB_ResidenceData.functionList.lights.Find((obj) => obj.bus_Data.SubnetID == subnetID && obj.bus_Data.DeviceID == deviceID && obj.bus_Data.LoopID == (i + 1));
+                            var light = FunctionList.List.lights.Find((obj) => obj.bus_Data.SubnetID == subnetID && obj.bus_Data.DeviceID == deviceID && obj.bus_Data.loopId == (i + 1));
                             if (light != null)
                             {
                                 if (light.functionType != FunctionType.RGB)
                                 {
-                                    light.trait_on_off.curValue = receiveBytes[light.bus_Data.LoopID] == 0 ? "off" : "on";
+                                    light.trait_on_off.curValue = receiveBytes[light.bus_Data.loopId] == 0 ? "off" : "on";
                                     if (light.trait_on_off.curValue.ToString() == "on")
                                     {
                                         light.brightness = receiveBytes[2];
@@ -191,7 +191,7 @@
                             }
                             else
                             {
-                                var e = DB_ResidenceData.functionList.electricals.Find((obj) => obj.bus_Data.SubnetID == subnetID && obj.bus_Data.DeviceID == deviceID && obj.bus_Data.LoopID == i);
+                                var e = FunctionList.List.electricals.Find((obj) => obj.bus_Data.SubnetID == subnetID && obj.bus_Data.DeviceID == deviceID && obj.bus_Data.loopId == i);
                                 if (e != null)
                                 {
                                     var fan = e as Fan;
@@ -220,7 +220,7 @@
                         break;
                     case Command.SetLogicLoopColorACK:
                     case Command.ReadLogicLoopColorACK:
-                        foreach (var rgb in DB_ResidenceData.functionList.lights)
+                        foreach (var rgb in FunctionList.List.lights)
                         {
                             if (rgb.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                             {
@@ -247,7 +247,7 @@
                         break;
                     case Command.SetCurtainModelStutasACK:
                     case Command.ReadCurtainStutasACK:
-                        foreach (var curtain in DB_ResidenceData.functionList.curtains)
+                        foreach (var curtain in FunctionList.List.curtains)
                         {
                             if (curtain.bus_Data.SubnetID == subnetID && curtain.bus_Data.DeviceID == deviceID)
                             {
@@ -266,7 +266,7 @@
                                 }
                                 else
                                 {
-                                    if (curtain.bus_Data.LoopID != receiveBytes[0])
+                                    if (curtain.bus_Data.loopId != receiveBytes[0])
                                         continue;
                                     switch (receiveBytes[1])
                                     {
@@ -304,7 +304,7 @@
                         break;
                     case Command.SetACModeACK:
                     case Command.ReadACModeACK:
-                        foreach (var ac in DB_ResidenceData.functionList.aCs)
+                        foreach (var ac in FunctionList.List.aCs)
                         {
                             if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                             {
@@ -359,7 +359,7 @@
                         break;
                     case Command.ReadFloorHeatACK:
                     case Command.SetFloorHeatACK:
-                        foreach (var fh in DB_ResidenceData.functionList.floorHeatings)
+                        foreach (var fh in FunctionList.List.floorHeatings)
                         {
                             if (fh.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                             {
@@ -443,12 +443,12 @@
                     case Command.ReadDeviceLoopInfoACK:
                         FunctionType dt = (FunctionType)(11 * 256 + receiveBytes[1]);
                         string tag = receiveBytes[1] + "_" + subnetID + "_" + deviceID + "_" + receiveBytes[2];
-                        foreach (var sensor in DB_ResidenceData.functionList.sensorsEnvironmentalScience)
+                        foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience)
                         {
                             if (sensor.bus_Data != null)
                             {
                                 if ((int)sensor.functionType % 256 == receiveBytes[1] && sensor.bus_Data.SubnetID == subnetID &&
-                                    sensor.bus_Data.DeviceID == deviceID && sensor.bus_Data.LoopID == receiveBytes[2])
+                                    sensor.bus_Data.DeviceID == deviceID && sensor.bus_Data.loopId == receiveBytes[2])
                                 {
                                     switch (dt)
                                     {
@@ -476,12 +476,12 @@
                         break;
                     case Command.New_Analog_Quantity_BROADCAST:
                         string tag1 = receiveBytes[1] + "_" + subnetID + "_" + deviceID + "_" + receiveBytes[2];
-                        foreach (var sensor in DB_ResidenceData.functionList.sensorsEnvironmentalScience)
+                        foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience)
                         {
                             if (sensor.bus_Data != null)
                             {
                                 if ((int)sensor.functionType % 256 == receiveBytes[1] && sensor.bus_Data.SubnetID == subnetID &&
-                                    sensor.bus_Data.DeviceID == deviceID && sensor.bus_Data.LoopID == receiveBytes[2])
+                                    sensor.bus_Data.DeviceID == deviceID && sensor.bus_Data.loopId == receiveBytes[2])
                                 {
                                     //0淇濈暀 1鏃犵鍙�4Byte鏁村舰  2鏈夌鍙�4Byte鏁村舰  3Float褰紙浠B憋級
                                     switch (receiveBytes[3])
@@ -524,7 +524,7 @@
                         {
                             break;
                         }
-                        foreach (var ac in DB_ResidenceData.functionList.aCs)
+                        foreach (var ac in FunctionList.List.aCs)
                         {
                             if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + reACPanel)
                             {
@@ -559,7 +559,7 @@
                         break;
                     case Command.ReadPanleTempACK://1944
                     case Command.PanleBroadcastTemp:
-                        foreach (var ac in DB_ResidenceData.functionList.aCs)
+                        foreach (var ac in FunctionList.List.aCs)
                         {
                             if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                             {
@@ -572,9 +572,11 @@
                         var mac = ByteToHex16(receiveBytes[5]) + ByteToHex16(receiveBytes[6]) + ByteToHex16(receiveBytes[7]) + ByteToHex16(receiveBytes[8]) + ByteToHex16(receiveBytes[9]) + ByteToHex16(receiveBytes[10]) + ByteToHex16(receiveBytes[11]) + ByteToHex16(receiveBytes[12]);
                         var Name = Encoding.GetEncoding("gb2312").GetString(receiveBytes, 13, 20).Trim('\0'); ;
                         MainPage.Log($"name : {Name} ; mac : {mac}");
-                        if (DB_ResidenceData.residenceData.residenceGatewayMAC == mac)
+                        if (DB_ResidenceData.Instance.residenceGatewayMAC == mac)
                         {
                             DriverLayer.Control.Ins.GatewayOnline = true;
+                            DriverLayer.Control.Ins.IsRemote = false;
+                            DAL.Mqtt.MqttClient.DisConnectRemote();//鏂紑mqtt
                         }
                         break;
                 }

--
Gitblit v1.8.0