From 3055ac3c5a7a18db21f2adc6a36f68ae0fd708c2 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 06 五月 2022 14:48:58 +0800
Subject: [PATCH] 定制
---
HDL_ON/DAL/Mqtt/MqttClient.cs | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index e617b29..60f8d2a 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -218,6 +218,12 @@
Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appDeviceRefresh/up",
QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
};
+ //璁惧鍦ㄧ嚎绂荤嚎鐘舵�佹帹閫�
+ var deviceOnlinePush = new MqttTopicFilter()
+ {
+ Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/son/session/online",
+ QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
+ };
//appRoomRefresh锛氭埧闂存暟鎹埛鏂伴�氱煡
var appRoomRefresh = new MqttTopicFilter()
{
@@ -253,6 +259,7 @@
pirStatus,pirStudy,
appDeviceRefresh,appHomeRefresh,appRoomRefresh,residenceChange,
topicFilterPush2, topicAlinkStatus ,mqttkeyChange,
+ deviceOnlinePush,
securityStatusChange});
if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0)
{
@@ -344,6 +351,32 @@
var mMes = Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
//鏂版尋涓嬬嚎涓婚鏂规 鏀跺埌鎸や笅绾夸富棰�
ReceiveNotifySqueezeAsync(mMes);
+ }
+ //璁惧鍦ㄧ嚎绂荤嚎鐘舵�佹帹閫�
+ else if(topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/son/session/online")
+ {
+ try
+ {
+ //var mMes = Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
+ //Newtonsoft.Json.Linq.JObject pairs = Newtonsoft.Json.Linq.JObject.Parse(mMes);
+ //var pairSid = pairs.GetValue("sid").ToString();
+ //var pairOnline = pairs.GetValue("online");
+ //if (!string.IsNullOrEmpty(pairSid.ToString()))
+ //{
+ // var function_online = FunctionList.List.Functions.Find((obj) => obj.sid == pairSid);
+ // if (function_online != null){
+ // function_online.online = (bool)pairOnline;
+ // HomePage.LoadEvent_RefreshDevcieOnline(function_online);
+ // FunctionPage.UpdataOnline(function_online);
+ // RoomPage.UpdataOnline(function_online);
+ // }
+ //}
+
+ }
+ catch(Exception ex)
+ {
+
+ }
}
//App璁㈤槄绾㈠瀹�/缃戝叧閬ユ帶鍣ㄦ坊鍔犳垚鍔熼�氱煡
else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/topo/found")
@@ -478,6 +511,7 @@
}
#endregion
//A缃戝叧璁惧鐘舵��-鍖呭惈娑傞甫璁惧
+ //Tag 缃戠粶鐘舵�佽В鏋�
else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/property/send")
{
var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
@@ -753,6 +787,9 @@
/// </summary>
static void ReceiveNotifySqueezeAsync(string mMes)
{
+#if DEBUG
+ return;
+#endif
if (mMes == PushSignStr) return;//鏄嚜宸辩殑鐧诲綍鎺ㄩ�佷笉澶勭悊//鎴栬�呭綋鍓嶄笉鏄繙绋嬮摼鎺ョ姸鎬�
//娴嬭瘯璐﹀彿锛屼笉鎸や笅绾�
switch (UserInfo.Current.userMobileInfo)
@@ -809,7 +846,9 @@
static void SendPushSignOut()
{
byte[] message = Encoding.UTF8.GetBytes(PushSignStr);
+#if DEBUG
MqttRemoteSend(message, 4);
+#endif
}
/// <summary>
--
Gitblit v1.8.0