From 7584dea0241cefc276a4b5311331aee1dcda6c80 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 16 三月 2021 11:44:41 +0800
Subject: [PATCH] Merge branch 'WJC' into temp-wxr

---
 HDL_ON/DAL/Mqtt/MqttClient.cs |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index 6b893ed..e97ced8 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -197,10 +197,17 @@
                         Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found",
                         QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
                     };
+                    //App璁㈤槄閬ユ帶鍣ㄨ嚜瀛︽寜閿涔犳垚鍔熼�氱煡
+                    var study = new MqttTopicFilter()
+                    {
+                        Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/irCodeStudyDone/up",
+                        QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
+                    };
 
                     Utlis.WriteLine("寮�濮嬭闃咃紒");
                     var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] {
                         pirStatus,
+                         study,
                         topicFilterPush2, topicAlinkStatus });
                     if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0)
                     {
@@ -242,7 +249,7 @@
 
             Utlis.WriteLine($"StartCloudMqtt: 寮�濮�");
 
-            await Task.Factory.StartNew(async () => {
+            await Task.Factory.StartNew((Func<Task>)(async () => {
                 try
                 {
                     #region 鍒濆鍖栬繙绋婱qtt
@@ -254,7 +261,7 @@
                     if (RemoteMqttClient.ApplicationMessageReceivedHandler == null)
                     {
                         //澶勭悊鎺ユ敹鍒扮殑鏁版嵁
-                        RemoteMqttClient.UseApplicationMessageReceivedHandler((e) => {
+                        RemoteMqttClient.UseApplicationMessageReceivedHandler((Action<MqttApplicationMessageReceivedEventArgs>)((e) => {
                             try
                             {
                                 var topic = e.ApplicationMessage.Topic;
@@ -301,7 +308,16 @@
                                 {
                                     var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                     var revString = Encoding.UTF8.GetString(bytes);
-                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontronsid = revString;
+                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.mqttdata = revString;
+                                    //ReceiveCheckGateway(ss);
+                                    //return;
+                                }
+                                //App璁㈤槄閬ユ帶鍣ㄨ嚜瀛︽寜閿涔犳垚鍔熼�氱煡
+                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/irCodeStudyDone/up")
+                                {
+                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
+                                    var revString = Encoding.UTF8.GetString(bytes);
+                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.mqttdata = revString;
                                     //ReceiveCheckGateway(ss);
                                     //return;
                                 }
@@ -332,7 +348,7 @@
                                 }
                             }
                             catch { }
-                        });
+                        }));
                     }
 
                     //(2)DisconnectedHandler
@@ -383,7 +399,7 @@
                     Utlis.WriteLine($"StartCloudMqtt: 缁撴潫");
                 }
 
-            });
+            }));
         }
 
 

--
Gitblit v1.8.0