From 792ca2a402feb952ef890d653f2e049c1230baf1 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期六, 19 十二月 2020 18:48:33 +0800
Subject: [PATCH] 1111

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

diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 64eb96a..13b5269 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -181,6 +181,9 @@
         /// </summary>
         public void SearchLoaclGateway()
         {
+            MainPage.Log($"鎼滅储鏈湴缃戝叧鍒楄〃锛岀綉鍏崇被鍨�:{DB_ResidenceData.Instance.GatewayType}");
+            if (MainPage.InternetStatus == 0)
+                return;
             OpenUdp(DB_ResidenceData.Instance.GatewayType == 0 ? 6000 : 8585);
             new System.Threading.Thread(() =>
             {
@@ -198,13 +201,13 @@
                     }
                     System.Threading.Thread.Sleep(500);
                 }
+                if (!GatewayOnline)//缃戝叧涓嶅湪绾跨殑鏃跺�欐墠鍙皾璇曡繙绋嬭繛鎺�
+                {
+                    Ins.IsRemote = true;
+                    DAL.Mqtt.MqttClient.InitState();
+                }
             })
             { IsBackground = true }.Start();
-            if (!GatewayOnline)//缃戝叧涓嶅湪绾跨殑鏃跺�欐墠鍙皾璇曡繙绋嬭繛鎺�
-            {
-                Ins.IsRemote = true;
-                DAL.Mqtt.MqttClient.InitState();
-            }
         }
 
         /// <summary>
@@ -565,7 +568,23 @@
                                     }
                                     break;
                                 case SPK.LightRGBW:
-                                case SPK.LightCCT:
+                                    break;
+                                case SPK.LightCCT:
+                                    var lightCCT = FunctionList.List.lights.Find((obj) => obj.sid == updateTemp.sid);
+                                    if (lightCCT != null)
+                                    {
+                                        localObj = lightCCT;
+                                        foreach (var attr in updateTemp.status)
+                                        {
+                                            var localAttr = lightCCT.attributes.Find((obj) => obj.key == attr.key);
+                                            if (localAttr != null)
+                                            {
+                                                localAttr.curValue = attr.value;
+                                            }
+                                        }
+                                        lightCCT.lastState = Language.StringByID(StringId.Brightness) + " : " + lightCCT.brightness + "%";
+                                        DimmerPage.UpdataStates(lightCCT);
+                                    }
                                     break;
                                 case SPK.CurtainSwitch:
                                     var curtain = FunctionList.List.curtains.Find((obj) => obj.sid == updateTemp.sid);

--
Gitblit v1.8.0