| | |
| | | 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 |
| | |
| | | var filePathList = FileUtlis.Files.ReadFiles(); |
| | | foreach (var filePath in filePathList) |
| | | { |
| | | _FunctionList.IniFunctionList(filePath); |
| | | try |
| | | { |
| | | _FunctionList.IniFunctionList(filePath); |
| | | } |
| | | catch { } |
| | | } |
| | | #endregion |
| | | } |
| | |
| | | /// 功能列表 |
| | | /// </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> |
| | | /// 绿建科技系统 |
| | | /// 总控列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<Function> GetAcstParentList() |
| | | { |
| | | return Functions.FindAll((obj) => obj.spk == SPK.AcstParent);//.OrderByDescending(o=>o.controlCounter).ToList() |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绿建科技系统 |
| | | /// 子控列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<Function> GetAcstSubList() |
| | | { |
| | | return Functions.FindAll((obj) => obj.spk == SPK.AcstSub); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空调列表 |
| | |
| | | return Functions.FindAll((obj) => spkList.Contains(obj.spk)); |
| | | } |
| | | |
| | | public List<Function> GetDoorLockList() |
| | | { |
| | | var spkList = SPK.GetDoorLockSPKList(); |
| | | return Functions.FindAll((obj) => spkList.Contains(obj.spk)); |
| | | } |
| | | /// <summary> |
| | | /// 获取萤石视频门锁 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<Function> GetVideoDoorLockList() |
| | | { |
| | | var spkList = SPK.GetVideoDoorLockSPKList(); |
| | | return Functions.FindAll((obj) => spkList.Contains(obj.spk)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 新风列表 |
| | | /// </summary> |
| | |
| | | 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> |
| | | /// 家电列表 |
| | |
| | | { |
| | | return Functions.FindAll((obj) => obj.spk == SPK.IrModule); |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 音乐列表 |
| | |
| | | var spkList = SPK.ArmSensorSpkList(); |
| | | return Functions.FindAll((obj) => spkList.Contains(obj.spk)); |
| | | } |
| | | /// <summary> |
| | | /// 安防中心支持的传感器列表 |
| | | /// </summary> |
| | | public List<Function> GetArmCenterList() |
| | | { |
| | | var spkList = new List<string>() |
| | | { |
| | | SPK.SensorPir, |
| | | SPK.SensorPirHold, |
| | | SPK.SensorDoorWindow, |
| | | SPK.SensorSmoke, |
| | | SPK.SensorWater, |
| | | SPK.SensorGas, |
| | | }; |
| | | |
| | | return Functions.FindAll((obj) => spkList.Contains(obj.spk)); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 可视对讲列表,当为null或size为0则不显示可视对讲icon |
| | |
| | | /// </summary> |
| | | public List<SecurityAlarm> securities = new List<SecurityAlarm>(); |
| | | |
| | | public List<SecurityAlarm> GetOrdinarySecurities() |
| | | { |
| | | var ordinarySecurities = new List<SecurityAlarm>(); |
| | | foreach (var mode in securities) |
| | | { |
| | | if (mode.type == "all_day" || mode.type == "mute") |
| | | { |
| | | continue; |
| | | } |
| | | ordinarySecurities.Add(mode); |
| | | } |
| | | return ordinarySecurities; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载功能列表 |
| | |
| | | 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); |
| | | } |
| | |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityAlarm>(dataString); |
| | | if (temp == null) |
| | | { |
| | | MainPage.Log("null"); |
| | | MainPage.Log("SecurityData_null"); |
| | | FileUtlis.Files.DeleteFile(filePath); |
| | | return; |
| | | } |
| | |
| | | { |
| | | MainPage.Log($"IniFunctionList error : {ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | 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; |
| | | } |
| | |
| | | /// <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> |
| | | /// 删除场景 |
| | | /// todo |
| | | /// </summary> |
| | | public void DeleteScene(Scene scene,bool upSevser) |
| | | { |
| | |
| | | |
| | | if(DriverLayer.Control.Ins.GatewayOnline_Local) |
| | | { |
| | | |
| | | //List<Function> functions = GetDeviceFunctionList(SPK.BrandType.Hdl); |
| | | //var sss = functions.OrderBy((obj) => obj.collect); |
| | | |
| | | List<Function> readList = new List<Function>(); |
| | | foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl)) |
| | | { |
| | | readList.Add(function); |
| | | MainPage.Log($"读取功能状态:{function.name} : {function.sid} "); |
| | | Control.Ins.SendReadCommand(function); |
| | | if (readList.Count > 9) |
| | | { |
| | | Control.Ins.SendReadCommand(readList); |
| | | readList.Clear(); |
| | | } |
| | | } |
| | | if(DB_ResidenceData.Instance.GatewayType == 1) |
| | | if (readList.Count > 0) |
| | | { |
| | | Control.Ins.SendReadCommand(readList); |
| | | } |
| | | if (DB_ResidenceData.Instance.GatewayType == 1) |
| | | { |
| | | Dictionary<string, string> pairs = new Dictionary<string, string>(); |
| | | string sendId = Control.Ins.msg_id.ToString(); |
| | |
| | | var page = new List<string>(); |
| | | int count = 0; |
| | | |
| | | //List<Function> functions = GetDeviceFunctionList(SPK.BrandType.Hdl); |
| | | //var sss = functions.OrderBy((obj) => obj.collect); |
| | | foreach (var function in GetDeviceFunctionList(SPK.BrandType.Hdl)) |
| | | { |
| | | page.Add(function.deviceId); |
| | |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | #region 场景相关 |
| | | #region 场景相关 |
| | | /// <summary> |
| | | /// 添加场景 |
| | | /// </summary> |
| | |
| | | } |
| | | return revPack.Code; |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 收藏功能 |
| | | #region 收藏功能 |
| | | |
| | | /// <summary> |
| | | /// 收藏场景 |
| | |
| | | return result; |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | #region |
| | | #region |
| | | |
| | | |
| | | |
| | | #endregion |
| | | #endregion |
| | | } |
| | | |
| | | } |