wxr
2022-09-27 0ee75b88cfe03e46289de0de96e8ed4580c797d3
HDL_ON/Common/ApiUtlis.cs
@@ -153,17 +153,35 @@
                        MainPage.Log($"读取房间数据失败:Code:{roomResult.Code}; msg:{roomResult.message}");
                    }
                    //===================设备=======================
                    var deviceResult = Ins.HttpRequest.GetDeviceList();
                    var deviceResult = Ins.HttpRequest.GetDeviceList("30","1");
                    if (deviceResult.Code == StateCode.SUCCESS)
                    {
                        endTime = DateTime.Now.AddSeconds(100);
                        endTime = DateTime.Now.AddSeconds(5);
                        MainPage.Log($"读取设备信息成功");
                        MainPage.Log($"sid列表获取===="+ deviceResult.Data.ToString());
                        var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
                        if (deviceList == null)
                        {
                            deviceList = new DevcieApiPack();
                        }
                        try
                        {
                            while (deviceList.totalPage != deviceList.pageNo)
                            {
                                var deviceResult2 = Ins.HttpRequest.GetDeviceList("30", Convert.ToInt32(deviceList.pageNo) + 1 + "");
                                if (deviceResult2.Code == StateCode.SUCCESS)
                                {
                                    var deviceList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
                                    deviceList.pageNo = deviceList2.pageNo;
                                    deviceList.list.AddRange(deviceList2.list);
                                }
                            }
                        }catch(Exception ex)
                        {
                        }
                        string delFile = "";
                        if (FunctionList.List.GetDeviceFunctionList().Count > 0)
                        {
@@ -267,7 +285,8 @@
                    //======================获取可视对讲设备列表====================
                    bool isInterphoneType_HDL = false;//是否为HDLLinphone可视对讲
                    var videoInfo= VideoSend.GetVideoInfoList();
                    bool isInterphoneType_FREEVIEW = false;//是否为全视通可视对讲
                    var videoInfo = VideoSend.GetVideoInfoList();
                    if (videoInfo.Code == StateCode.SUCCESS)
                    {
                        string videoList = videoInfo.Data.ToString();
@@ -282,6 +301,19 @@
                                isInterphoneType_HDL = true;
                                DB_ResidenceData.Instance.SupportFacePass = true;
                                DB_ResidenceData.Instance.SaveResidenceData();
                                Entity.DB_ResidenceData.Instance.SupportFVDevice = true;
                            }
                            else if (video.interphoneType == InterphoneType.FREEVIEW.ToString())
                            {//为全视通可视对讲
                                DB_ResidenceData.Instance.SupportFacePass = true;
                                Entity.DB_ResidenceData.Instance.SupportVisitorManage = true;
                                Entity.DB_ResidenceData.Instance.SupportFVDevice = true;
                                //isInterphoneType_HDL = true;
                                isInterphoneType_FREEVIEW = true;
                            }
                        }
                    }
@@ -293,7 +325,18 @@
                        if (isInterphoneType_HDL)
                        {
                            //HDLLinphone可视对讲,获取Sip账号并初始化SDK
                            HDLLinphone.Current.GetHDLSipInfoAndInitSDK(DB_ResidenceData.Instance.CurrentRegion.id);
                            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
                        {
@@ -302,6 +345,16 @@
                            HDLLinphone.Current.LogoutAllAccount();
                        }
                    }
                    //======================登录全视通====================
                    if (isInterphoneType_FREEVIEW)
                    {
#if __IOS__
                        //登录全视通
                        Shared.IOS.HDLFVSDK.Video.Init("", DB_ResidenceData.Instance.CurrentRegion.id);
#endif
                    }
                    //======================安防====================
                    GetSecurityList();
@@ -369,17 +422,48 @@
                {
                    if (DB_ResidenceData.Instance.CurrentRegion != null)
                    {
                        #region 读取本地数据
#region 读取本地数据
                        //搜索网关
                        DriverLayer.Control.Ins.SearchLoaclGateway();
                        //重新连接mqtt
                        DAL.Mqtt.MqttClient.DisConnectRemote("刷新数据,重连mqtt",false);
                        #endregion
#endregion
                    }
                }
            })
            { IsBackground = true }.Start();
            ////下载光伏数据
            //new System.Threading.Thread(() => {
            //    try
            //    {//00
            //        HttpServerRequest http = new HttpServerRequest();
            //        var packData = http.GetInverterList();
            //        if (packData != null)
            //        {
            //            if (packData.Code == StateCode.SUCCESS)
            //            {
            //                var inverterList = JsonConvert.DeserializeObject<List<InverterInfo>>(packData.Data.ToString());
            //                if (inverterList!= null)
            //                {
            //                    FunctionList.List.InverterList = inverterList;
            //                }
            //            }
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        MainPage.Log($"读取光伏数据异常:{ex.Message}");
            //    }
            //}) { IsBackground = true }.Start();
        }
        /// <summary>
@@ -427,6 +511,7 @@
                            FileUtlis.Files.DeleteFile(file);
                        }
                    }
                    FunctionList.List.securities.Clear();
                    foreach (var function in infoList)
                    {
                        function.SaveFile();