From 6bca8fcd37a48808a0b9c9342fc1be0adddfece6 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期五, 08 五月 2020 17:46:44 +0800 Subject: [PATCH] 请合并最新代码,优化绑定信息 --- ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs old mode 100644 new mode 100755 index 05f1cf9..104c55f --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs @@ -101,7 +101,7 @@ } } - #region variable + #region variable /// <summary> /// 杩滅▼杩炴帴鎴愬姛鏃剁殑鏃堕棿 /// </summary> @@ -2857,8 +2857,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; @@ -3051,8 +3051,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); @@ -3087,7 +3087,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) @@ -3099,7 +3099,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 { @@ -3218,7 +3218,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); @@ -3424,7 +3424,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