From 081ea8d273048fd03756718ac6fb48a3c09218e9 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期二, 29 十月 2019 13:10:00 +0800
Subject: [PATCH] Merge branch 'dev-tzy' into DEV_GXC

---
 ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
index 49cb86e..a9bb880 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
@@ -221,7 +221,6 @@
         /// <para>绗竴涓弬鏁帮細濡傛灉涓� DDevice/IsGetEpointInfo:鏈夋柊璁惧鍔犲叆zigbee缃戠粶鍙嶉</para>璁惧璇锋眰APP鑾峰彇鍗囩骇鏁版嵁
         /// <para>绗竴涓弬鏁帮細濡傛灉涓� Device/DeviceJoinZbNet:鑾峰彇鏂拌澶囨墍鏈夌鐐逛俊鎭槸鍚︽垚鍔熷弽棣�</para>
         /// <para>绗竴涓弬鏁帮細濡傛灉涓� DeviceRequestAcUpdateData: 璁惧璇锋眰绌鸿皟鍙戝崌绾ф暟鎹�</para>
-        /// "宸茬粡閫氱煡");//宸茬粡閫氱煡");
         /// </summary>
         [Newtonsoft.Json.JsonIgnore]
         public Action<string, object> ReportAction;
@@ -3317,7 +3316,10 @@
                         DefaultCommunicationTimeout = new TimeSpan(0, 0, 100),//璁剧疆瓒呮椂鏃堕棿
                     };
                     //杩滅▼閫氳杩炴帴锛岃繛鎺ヤ簯绔湇鍔″櫒 
-                    await RemoteMqttClient.ConnectAsync(connectCloudMqttClientOptions);
+                    if (RemoteMqttClient != null)
+                    {
+                        await RemoteMqttClient.ConnectAsync(connectCloudMqttClientOptions);
+                    }
 
                 }
                 catch (Exception ex)
@@ -3385,13 +3387,6 @@
         /// </summary>
         async System.Threading.Tasks.Task SendRemoteMsg(string topicName, byte[] message, MQTTnet.Core.Protocol.MqttQualityOfServiceLevel qosLevel = MQTTnet.Core.Protocol.MqttQualityOfServiceLevel.ExactlyOnce, bool retain = false)
         {
-            //#region MD5鍔犲瘑 token
-            //var result = System.Text.Encoding.UTF8.GetBytes(Shared.Common.Config.Instance.Password);
-            //var md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
-            //var output = md5.ComputeHash(result);
-            //var md5Password = BitConverter.ToString(output).Replace("-", "").ToUpper();
-            //#endregion
-
             //(1)鐢熸垚[鐢ㄦ埛鍚�:瀵嗙爜]
             var userNameAndPwdStr = string.Concat(Shared.Common.Config.Instance.Guid, RemoteOperatorConsts.CAP_NUMBER, Shared.Common.Config.Instance.MD5PWD);
             DebugPrintLog($"userNameAndPwdStr锛歿userNameAndPwdStr} ");
@@ -3402,11 +3397,10 @@
             //(3)灏�(2)缁х画鐢熸垚鏍煎紡[Base64(鐢ㄦ埛鍚�:瀵嗙爜):Timestamp]
             var userNameAndPwdStrBaseSexFourAndTimestamp = string.Concat(userNameAndPwdStrBaseSexFour, RemoteOperatorConsts.CAP_NUMBER, CurrentTimeStamp.ToString());
 
-            ///[Zigbee.Buspro]App/id(甯愬彿Id)/Base64(DES[Base64(鐢ㄦ埛鍚�:瀵嗙爜):Timestamp ]/缃戝叧鍞竴Id/杞彂缁欑綉鍏崇殑涓婚/XX/XX
+            //[Zigbee.Buspro]App/id(甯愬彿Id)/Base64(DES[Base64(鐢ㄦ埛鍚�:瀵嗙爜):Timestamp ]/缃戝叧鍞竴Id/杞彂缁欑綉鍏崇殑涓婚/XX/XX
             //(4)鐢熸垚涓婃姤涓婚锛屼富棰樻ā寮忛渶瑕佷负  /ZigbeeApp/id(涓诲瓙璋冭瘯甯愬彿Id)/Base64(DES[Base64(鐢ㄦ埛鍚�:瀵嗙爜):Timestamp ]/缃戝叧鍞竴Id/topicName "000204022022"   GateWayId  000204022022
             var reportTopic = string.Format("/{0}/{1}/{2}/{3}/{4}", RemoteOperatorConsts.ZIGBEE_APP_STARTS_WITH, Shared.Common.Config.Instance.Guid, userNameAndPwdStrBaseSexFourAndTimestamp, this.getGatewayBaseInfo?.gwID, topicName);
             var aa = System.Text.Encoding.UTF8.GetString(message);
-            DebugPrintLog($"AAAA鍙戦�佸埌浜戠涓婚鏄庢枃锛歿reportTopic}___BBBBB鍙戦�佸埌浜戠鍐呭鏄庢枃锛歿aa}");
 
             string topicEncStr = reportTopic;
             //鏂囦欢娴佷笉鐢ㄥ姞瀵�
@@ -3414,7 +3408,6 @@
             topicEncStr = topicEncStr.Replace("/", "[[$-MQTT_TILT_SYMBOL_REPLACE-$]]").Replace("+", "[[$-MQTT_PLUS_SYMBOL_REPLACE-$]]");
             message = System.Text.Encoding.UTF8.GetBytes(SecuritySet.AesEncrypt(message, Shared.Common.Config.Instance.MqttKey));
             var bb = System.Text.Encoding.UTF8.GetString(message);
-            DebugPrintLog($"CCCC鍙戦�佸埌浜戠涓婚绉樻枃锛歿topicEncStr}___DDDD鍙戦�佸埌浜戠鍐呭绉樻枃锛歿bb}");
 
             //(6)鏋勫缓Mqtt闇�瑕佸彂甯冪殑鏁版嵁鍖�,鍙戝竷缁欎簯绔殑MqttBroker
             await RemoteMqttClient.PublishAsync(new MQTTnet.Core.MqttApplicationMessage(topicEncStr, message, qosLevel, retain));

--
Gitblit v1.8.0