From d4811b7d34b45ff6b21b97f11da128b5572ec526 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 03 三月 2021 16:03:03 +0800
Subject: [PATCH] 20210303-1

---
 HDL_ON/Entity/FunctionList.cs |   99 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 71 insertions(+), 28 deletions(-)

diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index e963308..0395d89 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -79,6 +79,10 @@
                 {
                     waterValveList = new List<Function>();
                 }
+                if(clothesHangerList == null)
+                {
+                    clothesHangerList = new List<Function>();
+                }
                 var list = new List<Function>();
                 list.AddRange(fans);
                 list.AddRange(switchSockets);
@@ -86,6 +90,7 @@
                 list.AddRange(airCleaners);
                 list.AddRange(weepRobots);
                 list.AddRange(waterValveList);
+                list.AddRange(clothesHangerList);
                 return list;
             }
         }
@@ -113,6 +118,10 @@
         /// 姘撮榾鍒楄〃
         /// </summary>
         public List<Function> waterValveList = new List<Function>();
+        /// <summary>
+        /// 鍑夐湼鍒楄〃
+        /// </summary>
+        public List<Function> clothesHangerList = new List<Function>();
 
         #endregion
         /// <summary>
@@ -157,14 +166,9 @@
                 var tempFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString);
                 if (tempFunction == null)
                 {
-                    Common.FileUtlis.Files.DeleteFile(filePath);
+                    FileUtlis.Files.DeleteFile(filePath);
                     return;
                 }
-                if (tempFunction.DeleteSign)
-                {
-                    //todo 鍒犻櫎浜戠鏁版嵁 20201203--App涓嶈兘鍒犻櫎鍔熻兘鏁版嵁
-                }
-                else
                 {
                     switch (tempFunction.spk)
                     {
@@ -241,11 +245,16 @@
                             break;
                         case SPK.SensorSmoke:
                         case SPK.SensorWater:
-                        case SPK.SensorGas:
+                        case SPK.SensorDoorWindow:
                         case SPK.SensorPir:
                             var ser = Newtonsoft.Json.JsonConvert.DeserializeObject<Sensor>(functionDataString);
                             List.sensorsArm.Add(ser);
                             deviceFunctionList.Add(ser);
+                            break;
+                        case SPK.ClothesHanger:
+                            var ch = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString);
+                            List.clothesHangerList.Add(ch);
+                            deviceFunctionList.Add(ch);
                             break;
                     }
                 }
@@ -328,12 +337,19 @@
             List.lights = new List<Light>();
             List.curtains = new List<Curtain>();
             List.floorHeatings = new List<FloorHeating>();
-            List.tVs = new List<TV>();
-            List.switchSockets = new List<SwitchSocket>();
-            List.fans = new List<Fan>();
             List.sensorsEnvironmentalScience = new List<Sensor>();
+            #region 瀹剁數
+            List.fans = new List<Fan>();
+            List.switchSockets = new List<SwitchSocket>();
+            List.tVs = new List<TV>();
+            List.airCleaners = new List<AirCleaner>();
+            List.weepRobots = new List<WeepRobot>();
+            List.waterValveList = new List<Function>();
+            List.clothesHangerList = new List<Function>();
+            #endregion
+
             List.scenes = new List<Scene>();
-            List.deviceFunctionList = null;
+            List.deviceFunctionList = new List<Function>();
             _FunctionList = null;
         }
 
@@ -554,7 +570,26 @@
                     List.tVs.Remove(List.tVs.Find((obj) => obj.deviceId == delTemp.deviceId));
                     break;
                 case SPK.ElectricFan:
+                case SPK.ElectricTuyaFan:
                     List.fans.Remove(List.fans.Find((obj) => obj.deviceId == delTemp.deviceId));
+                    break;
+                case SPK.ElectricTuyaAirCleaner:
+                    List.airCleaners.Remove(List.airCleaners.Find((obj) => obj.deviceId == delTemp.deviceId));
+                    break;
+                case SPK.ElectricTuyaWaterValve:
+                    List.waterValveList.Remove(List.waterValveList.Find((obj) => obj.deviceId == delTemp.deviceId));
+                    break;
+                case SPK.ElectricTuyaWeepRobot:
+                    List.weepRobots.Remove(List.weepRobots.Find((obj) => obj.deviceId == delTemp.deviceId));
+                    break;
+                case SPK.ClothesHanger:
+                    List.clothesHangerList.Remove(List.clothesHangerList.Find((obj) => obj.deviceId == delTemp.deviceId));
+                    break;
+                case SPK.SensorSmoke:
+                case SPK.SensorWater:
+                case SPK.SensorDoorWindow:
+                case SPK.SensorPir:
+                    List.sensorsArm.Remove(List.sensorsArm.Find((obj)=>obj.deviceId == delTemp.deviceId));
                     break;
             }
             var removeTemp = deviceFunctionList.Find((obj) => obj.deviceId == delTemp.deviceId);
@@ -616,7 +651,31 @@
                 {
                     Read3tyFunctionStatus();
 
-                    if (DriverLayer.Control.Ins.IsRemote)
+                    if(DriverLayer.Control.Ins.GatewayOnline_Local)
+                    {
+                        foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl))
+                        {
+                            switch (function.Spk_Prefix)
+                            {
+                                case FunctionCategory.Music:
+                                case FunctionCategory.DryContact:
+                                    continue;
+                            }
+                            DriverLayer.Control.Ins.SendReadCommand(function);
+                            //switch (function.Spk_Prefix)
+                            //{
+                            //    case FunctionCategory.Light:
+                            //    case FunctionCategory.Electric:
+                            //    case FunctionCategory.Curtain:
+                            //    case FunctionCategory.AC:
+                            //    case FunctionCategory.FloorHeat:
+                            //    case FunctionCategory.Sensor:
+                            //        DriverLayer.Control.Ins.SendReadCommand(function);
+                            //        break;
+                            //}
+                        }
+                    }
+                    else
                     {
                         var page = new List<string>();
                         int count = 0;
@@ -633,22 +692,6 @@
                             }
                         }
                         DriverLayer.Control.Ins.SendApiReadCommand(page);
-                    }
-                    else
-                    {
-                        foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl))
-                        {
-                            switch (function.Spk_Prefix)
-                            {
-                                case FunctionCategory.Light:
-                                case FunctionCategory.Electric:
-                                case FunctionCategory.Curtain:
-                                case FunctionCategory.AC:
-                                case FunctionCategory.FloorHeat:
-                                    DriverLayer.Control.Ins.SendReadCommand(function);
-                                    break;
-                            }
-                        }
                     }
                 }
                 catch (Exception ex)

--
Gitblit v1.8.0