xm
2020-04-30 2eacb04ca1ec0ad20fda4186b59a9bce67004cb4
ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
old mode 100755 new mode 100644
@@ -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
            {