From 753e67c3705dddb8e913bd853db151f94f81d600 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 05 六月 2023 09:45:05 +0800
Subject: [PATCH] Merge branch 'Dev-Wxr'

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

diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index 383bda8..d5cd85e 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -204,6 +204,12 @@
                         Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/irCodeStudyDone/up",
                         QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
                     };
+                    //App璁㈤槄缇ゆ帶鐘舵�佷富棰�
+                    var groupControlStatus = new MqttTopicFilter()
+                    {
+                        Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/device/group/control/property/send",
+                        QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
+                    };
 
 
                     #region 鏁版嵁鏇存柊鎺ㄩ�佷富棰�
@@ -262,6 +268,11 @@
                         topicFilterPush2, topicAlinkStatus ,mqttkeyChange,
                         deviceOnlinePush,
                         securityStatusChange});
+                    //璁㈤槄缇ゆ帶鐘舵��
+                    if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
+                    {
+                        await RemoteMqttClient.SubscribeAsync(groupControlStatus);
+                    }
                     if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0)
                     {
                         isSubscribeSuccess = true;
@@ -363,7 +374,7 @@
                             try
                             {
                                 var topic = e.ApplicationMessage.Topic;
-                                //MainPage.Log($"鏀跺埌mqtt涓婚:{topic}");
+                                MainPage.Log($"鏀跺埌mqtt涓婚:{topic}");
                                 //涓�绔彛涓婚澶勭悊
                                 if (DB_ResidenceData.Instance.GatewayType == 0 && !DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
                                 {
@@ -446,10 +457,10 @@
                                 }
                                 #region 鏁版嵁鏇存柊鎺ㄩ�佷富棰�
                                 //appHomeRefresh锛氫綇瀹呮暟鎹埛鏂伴�氱煡
-                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appHomeRefresh/up"
-                                        || topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appDeviceRefresh/up")
+                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appHomeRefresh/up")
                                 {
                                     MainPage.Log("浣忓畢鏁版嵁鍒锋柊閫氱煡");
+                                    System.Threading.Thread.Sleep(2000);
                                     new HttpServerRequest().GetHomePager();
                                 }
                                 //appRoomRefresh锛氭埧闂存暟鎹埛鏂伴�氱煡
@@ -564,11 +575,18 @@
                                     }
                                 }
                                 #endregion
+                                //缇ゆ帶鐘舵��
+                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/device/group/control/property/send")
+                                {
+                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
+                                    var revString = Encoding.UTF8.GetString(bytes);
+                                    MainPage.Log($"mqtt 缇ゆ帶鐘舵�佹洿鏂�:{revString}");
+                                    Control.Ins.UpdataGroupControlStatus(revString, null, true);
+                                }
                                 //A缃戝叧璁惧鐘舵��-鍖呭惈娑傞甫璁惧
                                 //Tag 缃戠粶鐘舵�佽В鏋�
                                 else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/property/send")
                                 {
-
                                     var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                     var revString = Encoding.UTF8.GetString(bytes);
                                     MainPage.Log($"mqtt 鐘舵�佹洿鏂�:{revString}");
@@ -853,7 +871,7 @@
         static void ReceiveNotifySqueezeAsync(string mMes)
         {
 #if DEBUG
-            return;
+            //return;
 #endif
             if (mMes == PushSignStr) return;//鏄嚜宸辩殑鐧诲綍鎺ㄩ�佷笉澶勭悊//鎴栬�呭綋鍓嶄笉鏄繙绋嬮摼鎺ョ姸鎬�
             //娴嬭瘯璐﹀彿锛屼笉鎸や笅绾�

--
Gitblit v1.8.0