From 2eacb04ca1ec0ad20fda4186b59a9bce67004cb4 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期四, 30 四月 2020 17:45:33 +0800 Subject: [PATCH] 请合并小模块 --- ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs old mode 100755 new mode 100644 index a105443..09952d0 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs @@ -3273,8 +3273,8 @@ /// <summary> /// 杩滅▼MqttClient /// </summary> - public static IMqttClient RemoteMqttClient= new MqttFactory().CreateMqttClient(); - static bool remoteIsConnected; + public static IMqttClient RemoteMqttClient = new MqttFactory().CreateMqttClient(); + static bool remoteIsConnected; private int IsLogin = 0; [Newtonsoft.Json.JsonIgnore] static Action actionTemp; @@ -3467,8 +3467,8 @@ .WithTcpServer(domain, int.Parse(port)) .WithCredentials(connEmqUserName, connEmqPwd) .WithKeepAlivePeriod(TimeSpan.FromSeconds(20)) - .WithCleanSession() - //.WithCommunicationTimeout(TimeSpan.FromSeconds(10)) + .WithCleanSession() + //.WithCommunicationTimeout(TimeSpan.FromSeconds(10)) .Build(); await DisConnectRemoteMqttClient("StartRemoteMqtt"); await RemoteMqttClient.ConnectAsync(options, CancellationToken.None); @@ -3503,7 +3503,7 @@ localIsConnected = false; DebugPrintLog($"Local涓诲姩鏂紑_{s}"); //await localMqttClient.DisconnectAsync(new MQTTnet.Client.Disconnecting.MqttClientDisconnectOptions { }, CancellationToken.None); - await localMqttClient.DisconnectAsync(); + await localMqttClient.DisconnectAsync(); } } catch (Exception ex) @@ -3515,7 +3515,7 @@ /// <summary> /// 鏂紑杩滅▼Mqtt鐨勯摼鎺� /// </summary> - public static async System.Threading.Tasks.Task DisConnectRemoteMqttClient(string s="") + public static async System.Threading.Tasks.Task DisConnectRemoteMqttClient(string s = "") { try { @@ -3527,7 +3527,8 @@ await RemoteMqttClient.DisconnectAsync(); } } - catch(Exception e) { + catch (Exception e) + { DebugPrintLog($"Remote鏂紑閫氳杩炴帴鍑哄紓甯�:{e.Message}"); } } @@ -3633,7 +3634,7 @@ { await localMqttClient.PublishAsync(new MqttApplicationMessage { Topic = topic, Payload = message, QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.ExactlyOnce, Retain = retain }); } - catch(Exception e) + catch (Exception e) { DebugPrintLog($"Local涓诲姩鏂紑_{e.Message}"); await DisConnectLocalMqttClient(e.Message); @@ -3752,7 +3753,8 @@ { return; } - if (topics[2]== "NotifyGateWayInfoChange") { + if (topics[2] == "NotifyGateWayInfoChange") + { initGateWayBaseInfomation(); return; } @@ -3838,7 +3840,7 @@ /// <param name="topic">Topic.</param> /// <param name="message">Message.</param> /// <param name="e">E.</param> - static void ReceiveMessage(string topic, string message, byte []payload) + static void ReceiveMessage(string topic, string message, byte[] payload) { try { -- Gitblit v1.8.0