From 5a5a2b696866f947b6025d26c3302e8ffef46435 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期一, 11 一月 2021 16:11:20 +0800 Subject: [PATCH] 2021-01-11 1.更新MQTT连接和本地搜索网关方法。2.子账号相关接口完善 --- Crabtree/ON.Ios/AppDelegate.cs | 34 ++++++++++++++++++++-------------- 1 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Crabtree/ON.Ios/AppDelegate.cs b/Crabtree/ON.Ios/AppDelegate.cs index 6942a4c..884f733 100644 --- a/Crabtree/ON.Ios/AppDelegate.cs +++ b/Crabtree/ON.Ios/AppDelegate.cs @@ -6,6 +6,8 @@ using Microsoft.AppCenter.Analytics; using Microsoft.AppCenter.Crashes; using Shared; +using Shared.SimpleControl; +using SmartHome; using UIKit; using UserNotifications; @@ -75,9 +77,9 @@ AppCenter.Start ("44cbdfbf-d33e-4e92-a795-1c4452e54d3e", typeof (Analytics), typeof (Crashes)); Utlis.WriteLine ("FinishedLaunching"); //Shared.Application.IsGpsEnable = false; + //Shared.Application.IsUsePingFang = true; base.FinishedLaunching (application, launchOptions); - SharedMethod.SharedMethod.sharedApp = application; @@ -192,14 +194,14 @@ { Utlis.WriteLine ("OnResignActivation"); //Shared.BusSocket.Stop (); - BusSocketStop (); + //BusSocketStop (); } public override void DidEnterBackground (UIApplication application) { SharedMethod.SharedMethod.IsBackground = true; Utlis.WriteLine ("DidEnterBackground"); - //BusSocketStop (); + BusSocketStop (); } public override void WillEnterForeground (UIApplication application) @@ -211,7 +213,7 @@ UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; // Called as part of the transiton from background to active state. // Here you can undo many of the changes made on entering the background. - //BusSocketStart (); + BusSocketStart (); } public override void WillTerminate (UIApplication application) @@ -225,7 +227,7 @@ Utlis.WriteLine ("OnActivated"); base.OnActivated (application); - BusSocketStart (); + //BusSocketStart (); ////鏈変簺绯荤粺鐗堟湰杩欓噷鍚姩姣旇鍥炬帶鍒跺櫒蹇� //if (!Shared.SimpleControl.MainPage.Showed) { // System.Threading.Tasks.Task.Run (() => { @@ -256,14 +258,16 @@ //com.freeview.global.Video.FVapplicationDidBecomeActive (application); } - //DateTime closeTime = DateTime.MinValue; + DateTime closeTime = DateTime.MinValue; /// <summary> /// BusSocketStop /// </summary> void BusSocketStop () { + //杩涘叆鍚庡彴mqtt姝e湪杩炴帴閲嶇疆鐘舵�� + MqttCommon.remoteMqttIsConnecting = false; Shared.BusSocket.Stop (); - //closeTime = DateTime.Now; + closeTime = DateTime.Now; } @@ -272,12 +276,13 @@ /// </summary> void BusSocketStart () { - - //if (closeTime == DateTime.MinValue) { - // closeTime = DateTime.Now; - //} else if (closeTime.AddMinutes (2) > DateTime.Now) { - // // MqttCommon.DisConnectRemoteMqttClient (); - //} + if (closeTime == DateTime.MinValue) { + closeTime = DateTime.Now; + } else if (closeTime.AddSeconds (10) < DateTime.Now) { + if (CommonPage.IsRemote) { + MqttCommon.DisConnectRemote ("closeTime", false); + } + } var netStatus = (int)Reachability.InternetConnectionStatus (); //鏈変簺绯荤粺鐗堟湰杩欓噷鍚姩姣旇鍥炬帶鍒跺櫒蹇� @@ -307,7 +312,8 @@ if (SmartHome.WiFiSet.refreshView != null) { SmartHome.WiFiSet.refreshView (); } - + if (netStatus == 0) + return; } } } \ No newline at end of file -- Gitblit v1.8.0