From 9137222ece9b978eb97b5598f2eee6e070bcf9d6 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期五, 28 二月 2020 15:22:16 +0800 Subject: [PATCH] 2020-02-28 更新 --- Crabtree/SmartHome/HDL/Operation/Control.cs | 29 +++++++++++++++++++++++++---- 1 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Crabtree/SmartHome/HDL/Operation/Control.cs b/Crabtree/SmartHome/HDL/Operation/Control.cs index ded44d4..d1cd999 100644 --- a/Crabtree/SmartHome/HDL/Operation/Control.cs +++ b/Crabtree/SmartHome/HDL/Operation/Control.cs @@ -8,6 +8,7 @@ { public class Control { + public static bool IsEnterBackground = false; public bool IsCanShowTip; public System.DateTime LatestDateTime = System.DateTime.Now; @@ -164,6 +165,8 @@ case Command.SetGateWayTopicACK: case Command.ReadGateWayAdminInfoACK: case Command.SetGateWayAdminInfoACK: + case Command.ReadGateWayLocalEncryptionACK: + case Command.SetReadGateWayLocalEncryptionACK: //************************************ case Command.ReadGateWayModelInfoACK: case Command.ReadGatewayServerIPACK: @@ -216,6 +219,7 @@ case Command.READ_JOG_OPEN_TIME_ACK: case Command.SET_JOG_CLOSE_TIME_ACK: case Command.READ_JOG_CLOSE_TIME_ACK: + case Command.ReadRemarkACK: receiveFlag += ""; break; case Command.ControlMusicModel1ACK: @@ -383,14 +387,28 @@ void managerSendCount (object o) { add (); - if (Shared.SimpleControl.CommonPage.IsRemote && !isLocal) { + if (CommonPage.IsRemote && !isLocal) { + if (!SmartHome.MqttCommon.IsGatewayOnline) { + System.Threading.Thread.Sleep (500); + System.Console.WriteLine ($"缃戝叧涓嶅湪绾� 鍙栨秷鍙戦��:"+ SendFlag); + Packet.HaveSendCount = 3; + allDone.Set (); + return; + } + if (IsEnterBackground) { + System.Threading.Thread.Sleep (500); + System.Console.WriteLine ("宸茶繘鍏ュ悗鍙� 鍙栨秷鍙戦��"); + Packet.HaveSendCount = 3; + allDone.Set (); + return; + } System.Console.WriteLine ("杩滅▼鍙戦�佹暟鎹�:" + SendFlag); SmartHome.MqttCommon.MqttRemoteSend (Packet.Bytes); Packet.FlagDateTime = DateTime.Now; - Packet.HaveSendCount--; + Packet.HaveSendCount++; //杩欓噷鏄噸鍙戜袱娆� while (Packet.HaveSendCount < 3) { - if (Packet.FlagDateTime.AddMilliseconds (1000).Ticks <= System.DateTime.Now.Ticks) { + if (Packet.FlagDateTime.AddMilliseconds (2000).Ticks <= System.DateTime.Now.Ticks) { SmartHome.MqttCommon.MqttRemoteSend (Packet.Bytes); System.Console.WriteLine ("閲嶅彂杩滅▼鍙戦�佹暟鎹�:" + SendFlag); Packet.FlagDateTime = DateTime.Now; @@ -404,7 +422,7 @@ Packet.HaveSendCount--; //杩欓噷鏄噸鍙戜袱娆� - while (Packet.HaveSendCount < 3) { + while (Packet.HaveSendCount < 3 && BusSocket.IsRunning) { if (Packet.FlagDateTime.AddMilliseconds (1000).Ticks <= System.DateTime.Now.Ticks) { System.Console.WriteLine ("閲嶅彂鏁版嵁:" + SendFlag); BusSocket.AsyncBeginSend (Packet); @@ -493,6 +511,8 @@ case Command.SetGateWayTopic: case Command.ReadGateWayAdminInfo: case Command.SetGateWayAdminInfo: + case Command.SetGateWayLocalEncryption: + case Command.ReadGateWayLocalEncryption: //************************************ case Command.ReadGateWayModelInfo: case Command.ReadGatewayServerIP: @@ -546,6 +566,7 @@ case Command.READ_JOG_OPEN_TIME_CMD: case Command.SET_JOG_CLOSE_TIME_CMD: case Command.READ_JOG_CLOSE_TIME_CMD: + case Command.ReadRemark: this.SendFlag += ""; break; case Command.ControlMusicModel2: -- Gitblit v1.8.0