From 1c4904d77f484c075080942d87785481b52b6fb2 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期一, 28 十月 2019 14:58:46 +0800 Subject: [PATCH] Revert "Merge branch 'dev-tzy' into DEV_GXC" --- ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs index a9bb880..49cb86e 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs @@ -221,6 +221,7 @@ /// <para>绗竴涓弬鏁帮細濡傛灉涓� DDevice/IsGetEpointInfo:鏈夋柊璁惧鍔犲叆zigbee缃戠粶鍙嶉</para>璁惧璇锋眰APP鑾峰彇鍗囩骇鏁版嵁 /// <para>绗竴涓弬鏁帮細濡傛灉涓� Device/DeviceJoinZbNet:鑾峰彇鏂拌澶囨墍鏈夌鐐逛俊鎭槸鍚︽垚鍔熷弽棣�</para> /// <para>绗竴涓弬鏁帮細濡傛灉涓� DeviceRequestAcUpdateData: 璁惧璇锋眰绌鸿皟鍙戝崌绾ф暟鎹�</para> + /// "宸茬粡閫氱煡");//宸茬粡閫氱煡"); /// </summary> [Newtonsoft.Json.JsonIgnore] public Action<string, object> ReportAction; @@ -3316,10 +3317,7 @@ DefaultCommunicationTimeout = new TimeSpan(0, 0, 100),//璁剧疆瓒呮椂鏃堕棿 }; //杩滅▼閫氳杩炴帴锛岃繛鎺ヤ簯绔湇鍔″櫒 - if (RemoteMqttClient != null) - { - await RemoteMqttClient.ConnectAsync(connectCloudMqttClientOptions); - } + await RemoteMqttClient.ConnectAsync(connectCloudMqttClientOptions); } catch (Exception ex) @@ -3387,6 +3385,13 @@ /// </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} "); @@ -3397,10 +3402,11 @@ //(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; //鏂囦欢娴佷笉鐢ㄥ姞瀵� @@ -3408,6 +3414,7 @@ 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