JLChen
2021-08-18 c8c33200e43f05136eca9fc8ff4942f8def31cc6
HDL_ON/Common/ApiUtlis.cs
@@ -4,6 +4,8 @@
using HDL_ON.DAL;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI.UI2.FuntionControlView.Video;
using Newtonsoft.Json;
using Shared;
namespace HDL_ON.Common
@@ -106,6 +108,26 @@
                }
                endTime = DateTime.Now.AddSeconds(5);
                MainPage.Log($"刷新个人信息成功");
                //int count = 0;
                //while (count < 10)
                //{
                //    if (DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
                //    {
                //        System.Threading.Thread.Sleep(200);
                //    }
                //    else
                //    {
                //        break;
                //    }
                //    count++;
                //}
                //if (DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
                //{
                //    return;
                //}
                try
                {
                    //===================房间=======================
@@ -165,7 +187,7 @@
                        //处理剩下的新增功能
                        foreach (var newFunction in deviceList.list) 
                        {
                            MainPage.Log(newFunction.savePath);
                            newFunction.AssembleStatus();
                            newFunction.SaveFunctionFile();
                            FunctionList.List.IniFunctionList(newFunction.savePath);
                        }
@@ -229,17 +251,41 @@
                        MainPage.Log($"读取云端场景数据失败:Code:{pack.Code}; Msg:{pack.message}");
                    }
                    //===================读取安防列表==========================
                    GetSecurityList();
                    //===================读取逻辑列表==========================
                    UI.UI2.Intelligence.Automation.MainView.GetLogicList();
                    //===================读取可视对讲数据==========================
                    var flVideoInfo = HttpRequest.CheckFlVideo();
                    if(flVideoInfo.Code == StateCode.SUCCESS)
                    {
                        FunctionList.List.videoIntercom = Newtonsoft.Json.JsonConvert.DeserializeObject<UI.UI2.FuntionControlView.Video.VideoClouds>(flVideoInfo.Data.ToString());
                    }
                    //===================读取可视对讲数据==========================
                    //判断是否有可视对讲数据,有则显示可视对讲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可视对讲
                    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);
                        foreach (var video in FunctionList.List.videoIntercom)
                        {
                            if (video.interphoneType == InterphoneType.IMOUVISIAL.ToString())
                            {
                                UI.UI2.PersonalCenter.PirDevice.PirSend.LcSubAccessToken = video.subAccountToken;
                            } else if (video.interphoneType == InterphoneType.HDL.ToString()) {
                                isInterphoneType_HDL = true;
                            }
                        }
                    }
                    //======================获取Sip账号并且初始化SDK可视对讲设备列表====================
                    if (isInterphoneType_HDL)
                    {
                        //HDLLinphone可视对讲,获取Sip账号并初始化SDK
                        HDLLinphone.Current.getHDLSipInfoAndInitSDK(DB_ResidenceData.Instance.CurrentRegion.id);
                    }
                }
                catch (Exception ex)
                {
@@ -302,6 +348,8 @@
                        UI.Music.A31MusicModel.ReadMusicStates();
                        //搜索网关
                        DriverLayer.Control.Ins.SearchLoaclGateway();
                        //重新连接mqtt
                        DAL.Mqtt.MqttClient.DisConnectRemote("刷新数据,重连mqtt",false);
                        #endregion
                    }
                }