From cd70a2a8a2bdebf51259d8f39ed110a34b9be9e5 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 11 四月 2023 14:50:21 +0800 Subject: [PATCH] 修改启动屏幕 --- HDL_ON/DAL/Mqtt/MqttClient.cs | 31 +++++++++++++++++++++++++++---- 1 files changed, 27 insertions(+), 4 deletions(-) diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index ea5e472..12026aa 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; @@ -323,10 +334,12 @@ /// </summary> public static async Task StartCloudMqtt() { - if (MainPage.InternetStatus == 0) + //娌℃湁缃戠粶鐨勭姸鎬佷笅灏濊瘯涓�涓嬭繛鎺qtt 锛屽畨鍗撶殑缃戠粶鐘舵�佸彉鍖栫洃鍚湁寮傚父锛屼慨鏀瑰簳灞傞夯鐑� + if (MainPage.InternetStatus == 0 && MainPage.LinkHdlMqttCount > 1) { return; } + MainPage.LinkHdlMqttCount++; if (!UserInfo.Current.IsLogin) { @@ -444,8 +457,7 @@ } #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("浣忓畢鏁版嵁鍒锋柊閫氱煡"); new HttpServerRequest().GetHomePager(); @@ -562,11 +574,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}"); @@ -618,6 +637,10 @@ { IfNeedReadAllDeviceStatus = true; Control.Ins.GatewayOnline_Cloud = true; + if(MainPage.InternetStatus == 0) + { + MainPage.InternetStatus = 1; + } Utlis.WriteLine($"============>Mqtt杩滅▼杩炴帴鎴愬姛"); SendPushSignOut(); }); -- Gitblit v1.8.0