From 10afb4f79299cae08344fd8245a7217ea49f712e Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 09 八月 2023 11:27:45 +0800
Subject: [PATCH] 空调,地暖温度类型支持

---
 HDL_ON/DAL/DriverLayer/Control.cs |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index e60e1ae..e8a9655 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -1,6 +1,7 @@
 锘縰sing System;
 using System.Collections.Generic;
 using System.Text;
+using HDL_ON.DAL.Mqtt;
 using HDL_ON.DAL.Server;
 using HDL_ON.Entity;
 using HDL_ON.UI;
@@ -173,7 +174,16 @@
                             MainPage.Log($"缃戝叧浜戠鍦ㄧ嚎锛屽埛鏂拌澶囩姸鎬�");
                             new System.Threading.Thread(() =>
                             {
-                                System.Threading.Thread.Sleep(1000);
+                                int count = 20;
+                                while (true)
+                                {
+                                    System.Threading.Thread.Sleep(500);
+                                    if (MqttClient.isSubscribeSuccess || count<1)
+                                    {
+                                        break;
+                                    }
+                                    count--;
+                                }
                                 FunctionList.List.ReadAllFunctionStatus();
                             })
                             { IsBackground = true, Priority = System.Threading.ThreadPriority.AboveNormal }.Start();
@@ -251,6 +261,7 @@
         /// </summary>
         public void OpenTcpClent()
         {
+            return;
             if (myTcpClient == null)
             {
                 myTcpClient = new Control_TcpClient(reportIp);
@@ -325,6 +336,7 @@
         /// </summary>
         public void LoginGateway()
         {
+            return;//tcp鎺у埗瀛樺湪闂锛屼絾鏄厛涓嶇敤tcp鎺у埗浜嗭紝瑕佺粡杩囨祴璇曞厛  2023-07-29 10:14:32
             if (loginGatewayThread == null)
             {
                 loginGatewayThread = new System.Threading.Thread(() =>
@@ -1096,7 +1108,7 @@
                         Ins.IsLocalEncrypt = device.isLocalEncrypt;
                         //MainPage.Log("缃戝叧鏈湴鍔犲瘑鐘舵�侊細" + device.local_encrypt.ToString());
                         //鐧诲綍缃戝叧Tcp
-                        OpenTcpClent();
+                        //OpenTcpClent();
 
 
                     }
@@ -1198,7 +1210,7 @@
 
 
         /// <summary>
-        /// 鏇存柊璁惧鐘舵��
+        /// 鏇存柊缇ゆ帶璁惧鐘舵��
         /// A鍗忚鏁版嵁
         /// </summary>
         public void UpdataGroupControlStatus(string revString, byte[] usefulBytes, bool isCloudData = false)
@@ -1260,7 +1272,7 @@
             //    return;
             //}
 
-            var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString);
+            var temp = JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString);
             if (temp != null)
             {
                 Control_Udp.ReceiveRepeatManager(temp.id, usefulBytes);
@@ -1317,7 +1329,11 @@
                         {
                             localFunction.time_stamp = temp.time_stamp;
                             localFunction.SetAttrState(attr.key, attr.value);
-
+                            
+                        }
+                        if(localFunction.spk == SPK.AirSwitchP3)
+                        {
+                            localFunction.online = updateTemp.online;
                         }
 
                         //鏇存柊鐣岄潰鐘舵��
@@ -1337,6 +1353,10 @@
                                     EnergyMainPage.UpdataStatus(localFunction);
                                 }
                                 break;
+                            case SPK.AirSwitchP3:
+                                AirSwitchP3Page.UpdataState(localFunction);
+                                AirSwitchP3SubloopEnergyPage.UpdataStatus(localFunction);
+                                break;
                             case SPK.ElectricEnergy:
                                 EnergyMainPage.UpdataStatus(localFunction);
                                 break;

--
Gitblit v1.8.0