From 237e3ec4ee42724d43767d46f9a5320b8130e783 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 24 十二月 2020 22:47:53 +0800 Subject: [PATCH] 23 --- HDL_ON/DAL/Mqtt/MqttClient.cs | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index eb7a731..6f24899 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -32,18 +32,18 @@ /// </summary> static string RandomKey = ""; + /// <summary> + /// 闅忔満鐢熸垚瀛楃 + /// </summary> + /// <returns></returns> static string GetRandomKey() { if (string.IsNullOrEmpty(RandomKey)) { //闅忔満2浣嶅瓧绗︿覆 - Random random = new Random(Guid.NewGuid().GetHashCode()); - int num = random.Next(65, 91); - RandomKey = Convert.ToChar(num).ToString(); + RandomKey = Utlis.CreateRandomString(2); } - return RandomKey; - } /// <summary> @@ -186,14 +186,14 @@ Topic = $"/user/{MqttInfoConfig.Current.HomeGatewayInfo.gatewayId}/app/thing/property/send", QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }; - var topicBusStatus = new MqttTopicFilter() - { - Topic = $"/BusGateWayToClient/MacMask/Common", - QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce - }; + //var topicBusStatus = new MqttTopicFilter() + //{ + // Topic = $"/BusGateWayToClient/{}/Common", + // QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce + //}; Utlis.WriteLine("寮�濮嬭闃咃紒"); - var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { topicFilterBusGateWayToClient, topicFilterPush2, topicAlinkStatus, topicBusStatus }); + var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] { topicFilterBusGateWayToClient, topicFilterPush2, topicAlinkStatus }); if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) { isSubscribeSuccess = true; -- Gitblit v1.8.0