From 130a9b9cf4f5cd6ed8c11cb9cd4780f8b7da8bec Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 24 十二月 2020 23:17:59 +0800 Subject: [PATCH] Update ColorTureLampPageBLL.cs --- HDL_ON/DAL/Mqtt/MqttClient.cs | 36 ++++++++++++++++++------------------ 1 files changed, 18 insertions(+), 18 deletions(-) diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index fb5d3b5..1629706 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> @@ -132,7 +132,7 @@ static void InitMqtt() { new System.Threading.Thread(async () => { - while (hadGateway) + while (true) { try { @@ -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; @@ -291,12 +291,12 @@ packet.Bytes = e.ApplicationMessage.Payload; } #if DEBUG - string ddd = ""; - foreach (var bb in packet.Bytes) - { - ddd += bb + ","; - } - MainPage.Log($"mqtt bus data:{ddd}"); + //string ddd = ""; + //foreach (var bb in packet.Bytes) + //{ + // ddd += bb + ","; + //} + //MainPage.Log($"mqtt bus data:{ddd}"); #endif packet.Manager(); } -- Gitblit v1.8.0