From acc8caee31c4be90bd38d1af18136b0e84f6fe94 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期五, 27 九月 2024 14:01:19 +0800
Subject: [PATCH] Merge branch 'feature/v2.7_迭代' into feature/V2.7_Google

---
 HDL_ON/Entity/FunctionList.cs |  176 +++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 142 insertions(+), 34 deletions(-)

diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index cdd06aa..9b3858a 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -13,6 +13,22 @@
     public class FunctionList
     {
         static FunctionList _FunctionList;
+
+        //public static void ClearData()
+        //{
+        //    try
+        //    {
+        //        _FunctionList._IpCamImou = null;
+        //        _FunctionList.ClearDatas();
+        //        _FunctionList = null;
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        MainPage.Log($"娓呯悊FunctionList寮傚父:{ex.Message}");
+        //        _FunctionList = null;
+        //    }
+        //}
+
         public static FunctionList List
         {
             get
@@ -40,12 +56,52 @@
         /// </summary>
         public List<Function> Functions = new List<Function>();
         /// <summary>
+        /// 缇ゆ帶鍒楄〃
+        /// </summary>
+        public List<GroupControl> groupControls = new List<GroupControl>();
+
+
+        /// <summary>
         /// 鏈烘鑷傚垪琛�
         /// </summary>
         /// <returns></returns>
         public List<Function> GetMechanicalArmList()
         {
             return Functions.FindAll((obj) => obj.spk == SPK.MechanicalArm);
+        }
+
+        List<Function> _IpCamImou;
+        /// <summary>
+        /// 鑾峰彇鎽勫儚澶村垪琛�
+        /// </summary>
+        /// <returns></returns>
+        public List<Function> GetIpCamImouList()
+        {
+            if (_IpCamImou == null)
+            {
+                _IpCamImou = Functions.FindAll((obj) => obj.spk == SPK.IpCam_Imou);
+                if (_IpCamImou.Count > 0)
+                {
+#if __IOS__
+                    //鍒濆鍖栧ぇ鍗庢憚鍍忓ごsdk
+                    Shared.IOS.HDLCNVRSDK.HDLLCNVRSDK.SharedInstance().InitSDKWithAppKey("HDL-HOME-APP-TEST", "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss", OnAppConfig.Instance.RequestHttpsHost);
+                    Shared.IOS.HDLCNVRSDK.HDLLCNVRSDK.SharedInstance().AccessToken = UserInfo.Current.LoginTokenString;
+                    Shared.IOS.HDLCNVRSDK.HDLLCNVRSDK.SharedInstance().RefreshToken = UserInfo.Current.RefreshToken;
+                    Shared.IOS.HDLCNVRSDK.HDLLCNVRSDK.SharedInstance().HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
+                    Console.WriteLine("token锛�" + UserInfo.Current.LoginTokenString);
+                    Console.WriteLine("token锛�" + UserInfo.Current.RefreshToken);
+                    Shared.IOS.HDLCNVRSDK.HDLLCNVRSDK.SharedInstance().RefreshDeviceList();
+
+
+
+#else
+                    Com.Utils.HdlToLcUtils.Instance.InitData(Shared.Application.Activity, "HDL-HOME-APP-TEST", "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss", OnAppConfig.Instance.RequestHttpsHost);
+                    Com.Utils.HdlToLcUtils.Instance.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
+                    Com.Utils.HdlToLcUtils.Instance.Token = UserInfo.Current.AccessToken;
+#endif
+                }
+            }
+            return _IpCamImou;
         }
 
         /// <summary>
@@ -67,6 +123,28 @@
         {
             return Functions.FindAll((obj) => obj.spk == SPK.AcstSub);
         }
+        /// <summary>
+        /// 缁垮缓绉戞妧绯荤粺
+        /// 鐑按鍣ㄥ垪琛�
+        /// </summary>
+        /// <returns></returns>
+        public List<Function> GetWaterHeaterJinmaoList()
+        {
+            return Functions.FindAll((obj) => obj.spk == SPK.WaterHeaterJinmao);
+        }
+        /// <summary>
+        /// 閲戣寕鍏変紡鍌ㄨ兘
+        /// </summary>
+        /// <returns></returns>
+        public List<Function> GetInverterJinmaoList()
+        {
+            var tempList = Functions.FindAll((obj) => obj.spk == SPK.InverterJinmao);
+            foreach(var device in tempList)
+            {
+                device.collect = true;
+            }
+            return tempList;
+        }
 
         /// <summary>
         /// 绌鸿皟鍒楄〃
@@ -86,6 +164,15 @@
             var spkList = SPK.LightSpkList();
             return Functions.FindAll((obj) => spkList.Contains(obj.spk));
         }
+        /// <summary>
+        /// 搴忓垪鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public List<Function> GetSeries()
+        {
+            return Functions.FindAll((obj) => obj.spk == SPK.CommonSeries);
+        }
+
         /// <summary>
         /// 绐楀笜鍒楄〃
         /// </summary>
@@ -136,15 +223,7 @@
         /// </summary>
         public List<Function> InverterList()
         {
-            //get
-            //{
-            //    return _inverterList;
-            //}
-            //set
-            //{
-            //    _inverterList = value;
-            //}
-            return Functions.FindAll((obj) => obj.spk == SPK.Inverter);
+            return Functions.FindAll((obj) => obj.spk == SPK.Inverter || obj.spk == SPK.InverterRst);
         }
         #region 瀹剁數鍒楄〃 electricals
         /// <summary>
@@ -155,8 +234,8 @@
             var spkList = SPK.ElectricalSpkList();
             return Functions.FindAll((obj) => spkList.Contains(obj.spk));
         }
-    
-      
+
+
         /// <summary>
         /// 绾㈠瀹濆垪琛�
         /// </summary>
@@ -201,10 +280,13 @@
             var spkList = new List<string>()
             {
                 SPK.SensorPir,
+                SPK.SensorPirHold,
                 SPK.SensorDoorWindow,
                 SPK.SensorSmoke,
                 SPK.SensorWater,
                 SPK.SensorGas,
+                SPK.SensorDryContact,
+                SPK.SensorDryContact2,
             };
 
             return Functions.FindAll((obj) => spkList.Contains(obj.spk));
@@ -225,7 +307,7 @@
         {
             get
             {
-                if(_OtherBrandFunction == null)
+                if (_OtherBrandFunction == null)
                 {
                     _OtherBrandFunction = new List<Function>();
                     var spkList = SPK.GetAll3tySPK();
@@ -292,16 +374,24 @@
                     if (checkRepeat == true)
                     {
                         //妫�娴嬮噸澶�
-                        for (int i = 0; i < Functions.Count; i++)
+                        var same = Functions.FindAll((obj) => obj.deviceId == tempFunction.deviceId);
+                        if (same != null)
                         {
-                            if (Functions[i].deviceId == tempFunction.deviceId)
+                            foreach (var sameTemp in same)
                             {
-                                //鍏堢Щ闄ゆ帀鍐嶅姞
-                                Functions.RemoveAt(i);
-                                Functions.Add(tempFunction);
-                                return;
+                                Functions.Remove(sameTemp);
                             }
                         }
+                        //for (int i = 0; i < Functions.Count; i++)
+                        //{
+                        //    if (Functions[i].deviceId == tempFunction.deviceId)
+                        //    {
+                        //        //鍏堢Щ闄ゆ帀鍐嶅姞
+                        //        Functions.RemoveAt(i);
+                        //        Functions.Add(tempFunction);
+                        //        return;
+                        //    }
+                        //}
                     }
                     Functions.Add(tempFunction);
                 }
@@ -319,7 +409,7 @@
                     var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityAlarm>(dataString);
                     if (temp == null)
                     {
-                        MainPage.Log("null");
+                        MainPage.Log("SecurityData_null");
                         FileUtlis.Files.DeleteFile(filePath);
                         return;
                     }
@@ -344,6 +434,9 @@
             {
                 MainPage.Log($"IniFunctionList error : {ex.Message}");
             }
+            finally
+            {
+            }
         }
 
         /// <summary>
@@ -356,7 +449,7 @@
             {
             }
             else
-            { 
+            {
                 switch (brandType)
                 {
                     case SPK.BrandType.Hdl:
@@ -402,20 +495,32 @@
         /// <summary>
         /// 娓呯┖璁惧鍔熻兘鍒楄〃
         /// </summary>
-        public void Clear()
+        public void ClearDatas()
         {
-            Functions = new List<Function>();
-            _FunctionList = null;
+            try
+            {
+                if (_IpCamImou != null)
+                {
+                    _IpCamImou.Clear();
+                    _IpCamImou = null;
+                }
+                _FunctionList = new FunctionList();
+            }
+            catch (Exception ex)
+            {
+                MainPage.Log($"娓呯悊FunctionList寮傚父:{ex.Message}");
+                _FunctionList = null;
+            }
         }
 
         /// <summary>
         /// 鍔熻兘缁戝畾鎴块棿
         /// </summary>
-        public string FunctionsBindRooms(List<string> roomIds,List<string> deviceIds)
+        public string FunctionsBindRooms(List<string> roomIds, List<string> deviceIds)
         {
             var pm = new HttpServerRequest();
             var pack = pm.BindDeviceToRoom(deviceIds, roomIds);
-            if(pack.Code == StateCode.SUCCESS)
+            if (pack.Code == StateCode.SUCCESS)
             {
 
             }
@@ -428,9 +533,8 @@
 
         /// <summary>
         /// 鍒犻櫎鍦烘櫙
-        /// todo
         /// </summary>
-        public void DeleteScene(Scene scene,bool upSevser)
+        public void DeleteScene(Scene scene, bool upSevser)
         {
             if (upSevser)
             {
@@ -458,6 +562,10 @@
         /// </summary>
         public void DeleteFunction(Function delTemp)
         {
+            if(delTemp == null)
+            {
+                return;
+            }
             Functions.Remove(Functions.Find((obj) => obj.deviceId == delTemp.deviceId));
             FileUtlis.Files.DeleteFile(delTemp.savePath);
         }
@@ -497,14 +605,14 @@
         {
             if (lockReadFunctionStatus)
             {
-                MainPage.Log($"澶氭杩涘叆--杩斿洖");
+                MainPage.Log($"澶氭杩涘叆--杩斿洖1");
                 return;
             }
             new Thread(() =>
             {
                 if (lockReadFunctionStatus)
                 {
-                    MainPage.Log($"澶氭杩涘叆--杩斿洖");
+                    MainPage.Log($"澶氭杩涘叆--杩斿洖2");
                     return;
                 }
                 MainPage.Log($"杩涘叆--璇诲彇");
@@ -513,7 +621,7 @@
                 {
                     Read3tyFunctionStatus();
 
-                    if(DriverLayer.Control.Ins.GatewayOnline_Local)
+                    if (DriverLayer.Control.Ins.GatewayOnline_Local)
                     {
 
                         //List<Function> functions = GetDeviceFunctionList(SPK.BrandType.Hdl);
@@ -577,7 +685,7 @@
                     MainPage.Log($"缁撴潫--璇诲彇");
                 }
 
-                
+
             })
             { IsBackground = true }.Start();
         }
@@ -617,7 +725,7 @@
         #endregion
 
         #region 鏀惰棌鍔熻兘
-     
+
         /// <summary>
         /// 鏀惰棌鍦烘櫙
         /// </summary>
@@ -642,11 +750,11 @@
             return result;
         }
 
-        #endregion 
+        #endregion
 
 
         #region 
-       
+
 
 
         #endregion

--
Gitblit v1.8.0