| | |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.UI2.FuntionControlView.Video; |
| | | using HDL_ON.UI.UI2.Intelligence.Automation; |
| | | using MyJar; |
| | | using Newtonsoft.Json; |
| | | using Shared; |
| | | |
| | |
| | | /// 下载数据完成标记 |
| | | /// </summary> |
| | | public bool DownloadDataComplete = false; |
| | | |
| | | public bool hadInternet = true; |
| | | /// <summary> |
| | | /// 下载数据 |
| | | /// </summary> |
| | |
| | | MainPage.BaseView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | |
| | | string code = StateCode.SUCCESS; |
| | | |
| | | var downloadDataThread = new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | {//增加3秒云服务器连接检测,连不上服务器的时候不刷新数据 |
| | | var dataList = new List<GlobalRegionListRes>(); |
| | | var requestJson = HttpUtil.GetSignRequestJson(new GetRegionListObj() { regionMark = HttpUtil.RegionMark }); |
| | | { |
| | | //增加3秒云服务器连接检测,连不上服务器的时候不刷新数据 |
| | | hadInternet = true; |
| | | var dataList = new List<GlobalRegionListRes>(); |
| | | var requestJson = HttpUtil.GetSignRequestJson(new GetRegionListObj() { regionMark = HttpUtil.RegionMark }); |
| | | var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GlobalRegionList, requestJson, HttpUtil.GlobalRequestHttpsHost, "", 3); |
| | | |
| | | if (revertObj == null || revertObj.Code != StateCode.SUCCESS) |
| | | { |
| | | DownloadDataComplete = true; |
| | | hadInternet = false; |
| | | try |
| | | { |
| | | var spatialInfoDataBytes = FileUtlis.Files.ReadFile("SpatialInfoData"); |
| | |
| | | MainPage.Log($"{this.GetType()}:加载缓存设备数据异常:{ex.Message}"); |
| | | } |
| | | |
| | | |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | hadInternet = true; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | DownloadDataComplete = true; |
| | | return; |
| | | } |
| | | |
| | | finally |
| | | { |
| | | if (!hadInternet) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.Hide(); |
| | | waitPage.RemoveFromParent(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | MainPage.Log($"进入读取云端数据线程"); |
| | | //===================刷新Token======================= |
| | | code = Ins.HttpRequest.RefreshToken(); |
| | |
| | | if (roomResult.Code == StateCode.SUCCESS) |
| | | { |
| | | MainPage.Log($"读取房间信息成功"); |
| | | var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<SpatialApiPack>(roomResult.Data.ToString()); |
| | | var revData = JsonConvert.DeserializeObject<SpatialApiPack>(roomResult.Data.ToString()); |
| | | if (revData == null) |
| | | { |
| | | revData = new SpatialApiPack(); |
| | | } |
| | | { |
| | | SpatialInfo.CurrentSpatial.UpdateSpatialList(revData.list); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(revData.list)); |
| | | FileUtlis.Files.WriteFileByBytes("SpatialInfoData", ssd); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"{this.GetType()}:保存房间信息异常:{ex.Message}"); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | } |
| | | else |
| | |
| | | FunctionList.List.ClearDatas(); |
| | | //MainPage.Log($"============设备============开始" + FunctionList.List.Functions.Count); |
| | | //MainPage.Log($"读取设备信息成功"); |
| | | MainPage.Log($"sid列表获取====\r\n" , deviceResult.Data.ToString()); |
| | | MainPage.Log($"sid列表获取====\r\n", deviceResult.Data.ToString()); |
| | | var deviceList = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); |
| | | if (deviceList == null) |
| | | { |
| | |
| | | } |
| | | finally |
| | | { |
| | | |
| | | |
| | | } |
| | | |
| | | string delFile = ""; |
| | |
| | | foreach (var newFunction in deviceList.list) |
| | | { |
| | | newFunction.AssembleStatus(); |
| | | newFunction.SaveFunctionFile(); |
| | | FunctionList.List.IniFunctionList(newFunction.savePath,true); |
| | | newFunction.SaveFunctionFile(); |
| | | FunctionList.List.IniFunctionList(newFunction.savePath, true); |
| | | //MainPage.Log($"============设备============{iiii++}"); |
| | | } |
| | | |
| | |
| | | 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++) |
| | | for (int i = 0; i < FunctionList.List.videoIntercom.Count; i++) |
| | | { |
| | | var video = FunctionList.List.videoIntercom[i]; |
| | | |
| | |
| | | isInterphoneType_HDL = true; |
| | | DB_ResidenceData.Instance.SupportFacePass = true; |
| | | DB_ResidenceData.Instance.SaveResidenceData(); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | //如果检测线程没启动,才继续下面操作 因为App有可能刚启动马上收到推送了,然后才执行到这里 |
| | | if (HDLLinphone.Current.CheckIncomingCallThreadIsNull()) |
| | | { |
| | | |
| | | |
| | | //当前住宅是HDL可视对讲类型的设备 |
| | | if (isInterphoneType_HDL) |
| | | { |
| | |
| | | HDLLinphone.Current.LogoutAllAccount(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | MainPage.Log($"读取云端设备数据失败:Code:{deviceResult.Code}; Msg:{deviceResult.message}"); |
| | | } |
| | | }catch (Exception ex) |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"============设备============{ex.Message}"); |
| | | } |
| | |
| | | { |
| | | var groupControlList = JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString()); |
| | | var readSidList = new List<string>(); |
| | | foreach(var temp in groupControlList) |
| | | 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 != null) |
| | | { |
| | | if(data.Code == StateCode.SUCCESS) |
| | | if (data.Code == StateCode.SUCCESS) |
| | | { |
| | | var groupControlInfoList = JsonConvert.DeserializeObject<List<GroupControl>>(data.Data.ToString()); |
| | | FunctionList.List.groupControls.AddRange(groupControlInfoList); |
| | |
| | | { |
| | | MainPage.Log($"读取云端场景数据失败:Code:{pack.Code}; Msg:{pack.message}"); |
| | | } |
| | | }catch(Exception ex) |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"===场景==={ex.Message}"); |
| | | } |
| | |
| | | try |
| | | { |
| | | FunctionList.List.Read3tyFunctionStatus(); |
| | | }catch(Exception ex) |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log("读取第三方设备状态失败:"+ex.Message); |
| | | MainPage.Log("读取第三方设备状态失败:" + ex.Message); |
| | | } |
| | | } |
| | | }); |
| | |
| | | { |
| | | while (endTime1 > DateTime.Now) |
| | | { |
| | | if ( complateDevice && complateScene) |
| | | if (complateDevice && complateScene) |
| | | { |
| | | break; |
| | | } |
| | |
| | | { |
| | | if (DB_ResidenceData.Instance.CurrentRegion != null) |
| | | { |
| | | #region 读取本地数据 |
| | | #region 读取本地数据 |
| | | //搜索网关 |
| | | DriverLayer.Control.Ins.SearchLoaclGateway(); |
| | | //重新连接mqtt |
| | | DAL.Mqtt.MqttClient.DisConnectRemote("刷新数据,重连mqtt",false); |
| | | #endregion |
| | | DAL.Mqtt.MqttClient.DisConnectRemote("刷新数据,重连mqtt", false); |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | |
| | | MainPage.Log($"读取设备信息成功"); |
| | | var packList = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); |
| | | |
| | | foreach(var function in packList.list) |
| | | foreach (var function in packList.list) |
| | | { |
| | | function.SaveFunctionFile(); |
| | | FunctionList.List.IniFunctionList(function.savePath,true); |
| | | FunctionList.List.IniFunctionList(function.savePath, true); |
| | | } |
| | | } |
| | | } |