From 8bdaa9078e89f2db165c27de9d4d87cb0a05e18b Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 09 二月 2023 14:44:00 +0800
Subject: [PATCH] 修复全视通安卓版本无法监控的问题
---
HDL_ON/Entity/FunctionList.cs | 151 ++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 128 insertions(+), 23 deletions(-)
diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 9dce20e..f21e670 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
@@ -39,6 +55,57 @@
/// 鍔熻兘鍒楄〃
/// </summary>
public List<Function> Functions = new List<Function>();
+ /// <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__
+#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>
+ /// 缁垮缓绉戞妧绯荤粺
+ /// 鎬绘帶鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ public List<Function> GetAcstParentList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.AcstParent);
+ }
+
+ /// <summary>
+ /// 缁垮缓绉戞妧绯荤粺
+ /// 瀛愭帶鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ public List<Function> GetAcstSubList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.AcstSub);
+ }
/// <summary>
/// 绌鸿皟鍒楄〃
@@ -102,6 +169,14 @@
return Functions.FindAll((obj) => spkList.Contains(obj.spk));
}
+ List<InverterInfo> _inverterList = new List<InverterInfo>();
+ /// <summary>
+ /// 鍏変紡鍒楄〃
+ /// </summary>
+ public List<Function> InverterList()
+ {
+ return Functions.FindAll((obj) => obj.spk == SPK.Inverter || obj.spk == SPK.InverterRst);
+ }
#region 瀹剁數鍒楄〃 electricals
/// <summary>
/// 瀹剁數鍒楄〃
@@ -120,7 +195,7 @@
{
return Functions.FindAll((obj) => obj.spk == SPK.IrModule);
}
- #endregion
+#endregion
/// <summary>
/// 闊充箰鍒楄〃
@@ -248,16 +323,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);
}
@@ -300,6 +383,9 @@
{
MainPage.Log($"IniFunctionList error : {ex.Message}");
}
+ finally
+ {
+ }
}
/// <summary>
@@ -316,25 +402,33 @@
switch (brandType)
{
case SPK.BrandType.Hdl:
- foreach (var function in Functions)
+ try
{
- if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(function.spk))
+ foreach (var function in Functions)
{
- resultFunctions.Add(function);
+ if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(function.spk))
+ {
+ resultFunctions.Add(function);
+ }
}
}
+ catch { }
break;
case SPK.BrandType.Tuya:
lock (Functions)
{
- foreach (var function in Functions)
+ try
{
- if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk))
+ foreach (var function in Functions)
{
- resultFunctions.Add(function);
+ if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk))
+ {
+ resultFunctions.Add(function);
+ }
}
}
+ catch { }
}
break;
}
@@ -350,10 +444,22 @@
/// <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>
@@ -376,7 +482,6 @@
/// <summary>
/// 鍒犻櫎鍦烘櫙
- /// todo
/// </summary>
public void DeleteScene(Scene scene,bool upSevser)
{
@@ -530,7 +635,7 @@
{ IsBackground = true }.Start();
}
- #region 鍦烘櫙鐩稿叧
+#region 鍦烘櫙鐩稿叧
/// <summary>
/// 娣诲姞鍦烘櫙
/// </summary>
@@ -562,9 +667,9 @@
}
return revPack.Code;
}
- #endregion
+#endregion
- #region 鏀惰棌鍔熻兘
+#region 鏀惰棌鍔熻兘
/// <summary>
/// 鏀惰棌鍦烘櫙
@@ -590,14 +695,14 @@
return result;
}
- #endregion
+#endregion
- #region
+#region
- #endregion
+#endregion
}
}
--
Gitblit v1.8.0