From 7232642ff48a7fbde2018cde652f3e771fa58025 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期三, 27 一月 2021 14:32:55 +0800 Subject: [PATCH] 20200127-英文版处理 --- HDL_ON/DAL/Mqtt/MqttClient.cs | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index 1629706..2a95958 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -160,6 +160,10 @@ } static bool isSubscribeSuccess; + /// <summary> + /// 璁㈤槄涓婚 + /// </summary> + /// <returns></returns> static async Task SubscribeTopics() { if (remoteIsConnected && !isSubscribeSuccess) @@ -196,6 +200,7 @@ var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { topicFilterBusGateWayToClient, topicFilterPush2, topicAlinkStatus }); if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) { + Control.Ins.GatewayOnline = true; isSubscribeSuccess = true; Utlis.WriteLine("璁㈤槄鎴愬姛锛�"); @@ -269,6 +274,7 @@ } else if (topic == $"/BusGateWayToClient/{MqttInfoConfig.Current.HomeGatewayInfo.gatewayId}/Common/CheckGateway") { + var ss = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); ReceiveCheckGateway(ss); } @@ -327,7 +333,6 @@ { RemoteMqttClient.UseConnectedHandler(async (e) => { - Control.Ins.GatewayOnline = true; IfNeedReadAllDeviceStatus = true; Utlis.WriteLine($"============>Mqtt杩滅▼杩炴帴鎴愬姛"); SendPushSignOut(); @@ -540,9 +545,6 @@ /// </summary> static void ReceiveNotifySqueezeAsync(string mMes) { -#if DEBUG - return; -#endif if (mMes == PushSignStr) return;//鏄嚜宸辩殑鐧诲綍鎺ㄩ�佷笉澶勭悊 //鏂紑杩滅▼杩炴帴 @@ -605,8 +607,6 @@ /// <returns></returns> public static async Task MqttRemoteSend(byte[] message, int optionType = 0) { - //return; - try { string topicName; @@ -661,7 +661,17 @@ if (Control.Ins.IsRemote) { if (!Control.Ins.GatewayOnline) - Control.Ins.GatewayOnline = true; + { + try + { + if (DB_ResidenceData.Instance.HomeGateway != null) + { + DB_ResidenceData.Instance.HomeGateway.gatewayStatus = true; + } + Control.Ins.GatewayOnline = true; + } + catch { } + } } } -- Gitblit v1.8.0