| | |
| | | using HDL_ON.DAL; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.UI2.FuntionControlView.Video; |
| | | using HDL_ON.UI.UI2.Intelligence.Automation; |
| | | using Newtonsoft.Json; |
| | | using Shared; |
| | |
| | | //MainPage.Log($"============设备============{iiii++}"); |
| | | } |
| | | |
| | | |
| | | |
| | | //===================读取可视对讲数据========================== |
| | | //判断是否有可视对讲数据,有则显示可视对讲icon |
| | | //var flVideoInfo = HttpRequest.CheckFlVideo(); |
| | | //if(flVideoInfo.Code == StateCode.SUCCESS) |
| | | //{ |
| | | // FunctionList.List.videoIntercom1111 = Newtonsoft.Json.JsonConvert.DeserializeObject<UI.UI2.FuntionControlView.Video.VideoClouds>(flVideoInfo.Data.ToString()); |
| | | //} |
| | | |
| | | //======================获取可视对讲设备列表==================== |
| | | bool isInterphoneType_HDL = false;//是否为HDLLinphone可视对讲 |
| | | bool isInterphoneType_FREEVIEW = false;//是否为全视通可视对讲 |
| | | var videoInfo = VideoSend.GetVideoInfoList(); |
| | | if (videoInfo.Code == StateCode.SUCCESS) |
| | | { |
| | | string videoList = videoInfo.Data.ToString(); |
| | | FunctionList.List.videoIntercom = JsonConvert.DeserializeObject<List<UI.UI2.FuntionControlView.Video.Video>>(videoList); |
| | | |
| | | for(int i =0;i< FunctionList.List.videoIntercom.Count;i++) |
| | | { |
| | | var video = FunctionList.List.videoIntercom[i]; |
| | | |
| | | if (video.interphoneType == InterphoneType.IMOUVISIAL.ToString()) |
| | | { |
| | | UI.UI2.PersonalCenter.PirDevice.PirSend.LcSubAccessToken = video.subAccountToken; |
| | | } |
| | | else if (video.interphoneType == InterphoneType.HDL.ToString()) |
| | | { |
| | | isInterphoneType_HDL = true; |
| | | DB_ResidenceData.Instance.SupportFacePass = true; |
| | | DB_ResidenceData.Instance.SaveResidenceData(); |
| | | DB_ResidenceData.Instance.SupportFVDevice = true; |
| | | } |
| | | else if (video.interphoneType == InterphoneType.FREEVIEW.ToString()) |
| | | { |
| | | #if __IOS__ |
| | | try |
| | | { |
| | | FunctionList.List.videoIntercom.Remove(video); |
| | | --i; |
| | | }catch(Exception ex) |
| | | { |
| | | MainPage.Log($"ios 全视通异常 : {ex.Message}"); |
| | | } |
| | | |
| | | #else |
| | | //为全视通可视对讲 |
| | | DB_ResidenceData.Instance.SupportFacePass = true; |
| | | Entity.DB_ResidenceData.Instance.SupportVisitorManage = true; |
| | | Entity.DB_ResidenceData.Instance.SupportFVDevice = true; |
| | | isInterphoneType_FREEVIEW = true; |
| | | #endif |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //======================获取Sip账号并且初始化SDK可视对讲设备列表==================== |
| | | //如果检测线程没启动,才继续下面操作 因为App有可能刚启动马上收到推送了,然后才执行到这里 |
| | | if (HDLLinphone.Current.CheckIncomingCallThreadIsNull()) |
| | | { |
| | | |
| | | //当前住宅是HDL可视对讲类型的设备 |
| | | if (isInterphoneType_HDL) |
| | | { |
| | | //HDLLinphone可视对讲,获取Sip账号并初始化SDK |
| | | HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo(); |
| | | callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; |
| | | callVideoInfo.InterphoneType = InterphoneType.HDL.ToString(); |
| | | HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo); |
| | | } |
| | | else if (isInterphoneType_FREEVIEW) |
| | | { |
| | | //HDLLinphone可视对讲,获取Sip账号并初始化SDK |
| | | HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo(); |
| | | callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; |
| | | callVideoInfo.InterphoneType = InterphoneType.FREEVIEW.ToString(); |
| | | HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("当前住宅不支持HDL可视对讲,退出登录所有账号"); |
| | | //当前住宅不支持HDL可视对讲 |
| | | HDLLinphone.Current.LogoutAllAccount(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //======================登录全视通==================== |
| | | if (isInterphoneType_FREEVIEW) |
| | | { |
| | | |
| | | #if __IOS__ |
| | | //string systemVersion = UIKit.UIDevice.CurrentDevice.SystemVersion; |
| | | //string errorVersion = "16.2.0"; |
| | | //if (systemVersion.CompareTo(errorVersion) < 0)///全视通不兼容ios16以上的系统,不要加载这个先 |
| | | //{ |
| | | // List<VisitorTempPassword> dataList = new List<VisitorTempPassword>(); |
| | | // Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| | | // dictionary.Add("homeId", Entity.DB_ResidenceData.Instance.CurrentRegion.id); |
| | | // var requestJson = HttpUtil.GetSignRequestJson(dictionary); |
| | | // ResponsePackNew pack = HttpUtil.RequestHttpsPost(NewAPI.Api_Post_GetExtMemberInfo, requestJson); |
| | | // if (pack != null) |
| | | // { |
| | | // var data = JsonConvert.DeserializeObject<FreeviewMemberInfo>(pack.Data.ToString()); |
| | | // //登录全视通 |
| | | // Shared.IOS.HDLFVSDK.Video.Init("", data.extUserId, DB_ResidenceData.Instance.CurrentRegion.id, "78FF1E4D-FC0A-4E71-9B79-0448E4460BD7", "T0001", "120.77.53.170:9700", "120.77.53.170:21664"); |
| | | // } |
| | | //} |
| | | #endif |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | MainPage.Log($"============设备============完成" + FunctionList.List.Functions.Count); |
| | | } |
| | | |
| | | |
| | | //======================群控==================== |
| | | if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) |
| | | { |
| | | var pack = Ins.HttpRequest.GetGroupControlList(); |
| | | if (pack != null) |
| | | { |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | try |
| | | { |
| | | var groupControlList = JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString()); |
| | | var readSidList = new List<string>(); |
| | | foreach(var temp in groupControlList) |
| | | { |
| | | FunctionList.List.groupControls.Clear(); |
| | | readSidList.Add(temp.userDeviceGroupControlId); |
| | | if (readSidList.Count >= 20) |
| | | { |
| | | var data = Ins.httpRequest.GetGroupControInfo(readSidList); |
| | | if(data != null) |
| | | { |
| | | if(data.Code == StateCode.SUCCESS) |
| | | { |
| | | var groupControlInfoList = JsonConvert.DeserializeObject<List<GroupControl>>(data.Data.ToString()); |
| | | FunctionList.List.groupControls.AddRange(groupControlInfoList); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); |
| | | } |
| | | } |
| | | readSidList.Clear(); |
| | | } |
| | | //FunctionList.List.Functions.AddRange(FunctionList.List.groupControls); |
| | | } |
| | | if (readSidList.Count > 0) |
| | | { |
| | | var data = Ins.httpRequest.GetGroupControInfo(readSidList); |
| | | if (data != null) |
| | | { |
| | | if (data.Code == StateCode.SUCCESS) |
| | | { |
| | | var groupControlInfoList = JsonConvert.DeserializeObject<List<GroupControl>>(data.Data.ToString()); |
| | | FunctionList.List.groupControls.AddRange(groupControlInfoList); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); |
| | | } |
| | | } |
| | | readSidList.Clear(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"读取组控列表失败:{ex.Message}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); |
| | | } |
| | | } |
| | | } |
| | | //======================场景==================== |
| | | try |
| | | { |
| | |
| | | complateScene = true; |
| | | } |
| | | |
| | | //======================安防==================== |
| | | GetSecurityList(); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | |
| | | }); |
| | | //不考虑网关情况,直接订阅 |
| | | DAL.Mqtt.MqttClient.InitState(); |
| | | |
| | | try |
| | | { |
| | | FunctionList.List.Read3tyFunctionStatus(); |
| | | }catch(Exception ex) |
| | | { |
| | | MainPage.Log("读取第三方设备状态失败:"+ex.Message); |
| | | } |
| | | } |
| | | }); |
| | | downloadDataThread.IsBackground = true; |
| | |
| | | { |
| | | function.SaveFunctionFile(); |
| | | FunctionList.List.IniFunctionList(function.savePath,true); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取安防列表 |
| | | /// </summary> |
| | | public void GetSecurityList() |
| | | { |
| | | lock (FunctionList.List.securities) |
| | | { |
| | | var pack = Ins.HttpRequest.GetSecurityList(); |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | var packList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(pack.Data.ToString()); |
| | | Console.WriteLine("安防总数:" + packList.Count); |
| | | var sidList = new List<string>(); |
| | | foreach (var function in packList) |
| | | { |
| | | sidList.Add(function.sid); |
| | | } |
| | | var infoListPack = Ins.httpRequest.GetSecurityInfo(sidList, new List<string>()); |
| | | var infoList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(infoListPack.Data.ToString()); |
| | | if (infoList != null) |
| | | { |
| | | var filePathList = FileUtlis.Files.ReadFiles().FindAll((obj) => obj.StartsWith("SecurityData_")); |
| | | if (filePathList != null) |
| | | { |
| | | foreach (var file in filePathList) |
| | | { |
| | | FileUtlis.Files.DeleteFile(file); |
| | | } |
| | | } |
| | | FunctionList.List.securities.Clear(); |
| | | foreach (var function in infoList) |
| | | { |
| | | function.SaveFile(); |
| | | FunctionList.List.IniFunctionList(function.savePath, true); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | MainPage.Log($"读取安防列表失败:Code:{pack.Code}; Msg:{pack.message}"); |
| | | } |
| | | } |
| | | } |