From df8d4ab0ef17a7fab5dea9c47bbd9f4d4a2a40b0 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 15 三月 2021 14:55:49 +0800 Subject: [PATCH] 合并前上传一个版本 --- HDL_ON/UI/UI0-Stan/Logic/HdlCloudReceiveLogic.cs | 34 ++++++++++++++++++++++++++++++---- 1 files changed, 30 insertions(+), 4 deletions(-) diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlCloudReceiveLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlCloudReceiveLogic.cs index 7a3f147..81c4959 100644 --- a/HDL_ON/UI/UI0-Stan/Logic/HdlCloudReceiveLogic.cs +++ b/HDL_ON/UI/UI0-Stan/Logic/HdlCloudReceiveLogic.cs @@ -50,24 +50,50 @@ #region 鈻� 鍏ㄥ眬鎺ユ敹___________________________ /// <summary> - /// 鍏ㄥ眬鎺ユ敹浜戠鎺ㄩ�佺殑鐨勯�昏緫(涓轰簡鎵ц閫熷害,灏藉彲鑳界殑鍒姞鑰楁椂鐨勬搷浣�) + /// 鐗规畩鍏ㄥ眬鎺ユ敹浜戠鎺ㄩ�佺殑鐨勯�昏緫(涓轰簡鎵ц閫熷害,灏藉彲鑳界殑鍒姞鑰楁椂鐨勬搷浣� true:鎵ц浜嗙壒娈婂鐞� false:娌℃湁鎵ц鐗规畩澶勭悊) + /// </summary> + /// <param name="topic">鏁翠釜涓婚</param> + /// <param name="byteData">鎺ユ敹鐨勬暟鎹�</param> + /// <param name="mqttEncryptKey">Mqtt鐨勮В瀵嗗瘑閽�</param> + /// <param name="homeIdEncryptKey">浣忓畢鍊掑簭鐨勮В瀵嗗瘑閽�</param> + public bool CloudOverallMsgReceiveEx(string topic, byte[] byteData, string mqttEncryptKey, string homeIdEncryptKey) + { + //璁惧鍏ョ綉涓婃姤涓婚 + if (topic == $"/user/{Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found") + { + if (string.IsNullOrEmpty(homeIdEncryptKey) == false) + { + //瑙e瘑 + byteData = Securitys.EncryptionService.AesDecryptPayload(byteData, homeIdEncryptKey); + } + string msgData = Encoding.UTF8.GetString(byteData); + //杩欓噷鐗规畩,鍒�ョ潃杞瓧绗︿覆,鍏堝垽鏂富棰樺啀杞� + return this.CloudOverallMsgReceiveEx(topic, msgData); + } + return false; + } + + /// <summary> + /// 鐗规畩鍏ㄥ眬鎺ユ敹浜戠鎺ㄩ�佺殑鐨勯�昏緫(涓轰簡鎵ц閫熷害,灏藉彲鑳界殑鍒姞鑰楁椂鐨勬搷浣� true:鎵ц浜嗙壒娈婂鐞� false:娌℃湁鎵ц鐗规畩澶勭悊) /// </summary> /// <param name="topic">鏁翠釜涓婚</param> /// <param name="msgData">鎺ユ敹鐨勬暟鎹�</param> - public void CloudOverallMsgReceive(string topic, string msgData) + public bool CloudOverallMsgReceiveEx(string topic, string msgData) { //娌℃湁浠讳綍鐩戝惉 - if (ListCloudEvent.Count == 0) { return; } + if (ListCloudEvent.Count == 0) { return false; } //璁惧鍏ョ綉涓婃姤涓婚(鐩墠鍙湁绾㈠瀹�) - if (topic == DriverLayer.CommunicationTopic.ct.AddDevicePush) + if (topic == $"/user/{Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found") { for (int i = 0; i < this.ListCloudEvent.Count; i++) { //鍥炶皟浜嬩欢 this.ListCloudEvent[i].CloudReceiveEvent(CloudPushEnum.A鏂拌澶囦笂鎶�, msgData); } + return true; } + return false; } #endregion -- Gitblit v1.8.0