From 026ed1573ad8b9ba28f0e2c0bf0c9cd85f1dd2ed Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期三, 02 十二月 2020 16:32:00 +0800 Subject: [PATCH] 2020-12-02 1.增加子账号设备分享。 2.房间删除时间优化。3.消息中心接口对接。4.版本检测更新接口对接。 --- HDL_ON/DAL/Mqtt/MqttClient.cs | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index dba1acf..ea06685 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -1,7 +1,6 @@ 锘�/* 鏇存柊浜咵MQ杩炴帴鏂瑰紡 */ -using System.Collections.Generic; using System; using MQTTnet.Client; using System.Threading.Tasks; @@ -9,7 +8,6 @@ using MQTTnet; using System.Text; using System.Security.Cryptography; -using System.IO; using HDL_ON.DriverLayer; using HDL_ON.Entity; @@ -168,7 +166,7 @@ //2020-05-14 璁㈤槄涓婚璐ㄩ噺鏀逛负0 var topicFilterBusGateWayToClient = new MqttTopicFilter() { - Topic = $"/BusGateWayToClient/{MqttInfoConfig.Current.HomeGatewayInfo.id}/#", + Topic = $"/BusGateWayToClient/{MqttInfoConfig.Current.HomeGatewayInfo.gatewayId}/#", QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce //QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.ExactlyOnce }; @@ -246,17 +244,17 @@ //鏂版尋涓嬬嚎涓婚鏂规 鏀跺埌鎸や笅绾夸富棰� ReceiveNotifySqueezeAsync(mMes); } - else if (topic == $"/BusGateWayToClient/{MqttInfoConfig.Current.HomeGatewayInfo.id}/NotifyBusGateWayInfoChange") + else if (topic == $"/BusGateWayToClient/{MqttInfoConfig.Current.HomeGatewayInfo.gatewayId}/NotifyBusGateWayInfoChange") {//缃戝叧涓婄嚎锛岄渶瑕佹洿鏂癮eskey //鏀跺埌缃戝叧涓婄嚎娑堟伅涓婚 ReceiveNotifyBusGateWayInfoChange(); } - else if (topic == $"/BusGateWayToClient/{MqttInfoConfig.Current.HomeGatewayInfo.id}/NotifyGateWayOffline") + else if (topic == $"/BusGateWayToClient/{MqttInfoConfig.Current.HomeGatewayInfo.gatewayId}/NotifyGateWayOffline") {//缃戝叧鎺夌嚎 //----绗簩姝ワ細璇诲彇璐﹀彿涓嬮潰鐨勭綉鍏冲垪琛� ReceiveNotifyGateWayOffline(); } - else if (topic == $"/BusGateWayToClient/{MqttInfoConfig.Current.HomeGatewayInfo.id}/Common/CheckGateway") + else if (topic == $"/BusGateWayToClient/{MqttInfoConfig.Current.HomeGatewayInfo.gatewayId}/Common/CheckGateway") { var ss = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); ReceiveCheckGateway(ss); @@ -583,7 +581,7 @@ switch (optionType) { case 0: - topicName = $"/ClientToBusGateWay/{MqttInfoConfig.Current.HomeGatewayInfo.id}/Common/ON"; + topicName = $"/ClientToBusGateWay/{MqttInfoConfig.Current.HomeGatewayInfo.gatewayId}/Common/ON"; if (!string.IsNullOrEmpty(mqttEncryptKey)) { message = Securitys.EncryptionService.AesEncryptPayload(message, mqttEncryptKey); @@ -591,7 +589,7 @@ await RemoteMqttClient.PublishAsync(new MqttApplicationMessage { Topic = topicName, Payload = message, Retain = false, QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }); break; case 3: - topicName = $"/ClientToBusGateWay/{MqttInfoConfig.Current.HomeGatewayInfo.id}/Common/CheckGateway"; + topicName = $"/ClientToBusGateWay/{MqttInfoConfig.Current.HomeGatewayInfo.gatewayId}/Common/CheckGateway"; Utlis.WriteLine("CheckGateway"); await RemoteMqttClient.PublishAsync(new MqttApplicationMessage { Topic = topicName, Retain = false, QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }); break; -- Gitblit v1.8.0