From 64390bc739286477167e186f1f2b40a27a73a9a5 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期二, 02 三月 2021 17:31:01 +0800
Subject: [PATCH] 20210302-1

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

diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 58821fd..1d8c208 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -733,9 +733,17 @@
         /// A鍗忚鏁版嵁
         /// </summary>
         /// <param name="updateBytes"></param>
-        public void UpdataFunctionStatus(string revString, byte[] usefulBytes)
+        public void UpdataFunctionStatus(string revString, byte[] usefulBytes,bool isCloudData = false)
         {
-            MainPage.Log($"A鍗忚鏇存柊鐘舵��:{revString}");
+
+            if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�
+            {
+                if (FunctionList.List.GetDeviceFunctionList(SPK.BrandType.Tuya).Count == 0)
+                {
+                    //MainPage.Log($"A鍗忚鏇存柊鐘舵��:鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�...");
+                    return;
+                }
+            }
             var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString);
             if (temp != null)
             {
@@ -745,8 +753,25 @@
                 {
                     try
                     {
-                        //bool hadChange = false;//鐘舵�佹湁鍙樺寲鍐嶆洿鏂扮晫闈�
                         var localFunction = allLocalFuntion.Find((obj) => obj.sid == updateTemp.sid);
+                        if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�
+                        {
+                            if(!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk))
+                            {
+                                //MainPage.Log($"A鍗忚鏇存柊鐘舵��:鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�........");
+                                return;
+                            }
+                        }
+                        //MainPage.Log($"A鍗忚鏇存柊鐘舵��:{revString}");
+                        foreach (var attr in updateTemp.status)
+                        {
+                            var attrState = localFunction.status.Find((func) => func.key == attr.key);
+                            if(attrState!= null)
+                            {
+                                attrState.value = attr.value;
+                            }
+                        }
+
                         if (localFunction != null)
                         {
                             //鏇存柊鐣岄潰鐘舵��

--
Gitblit v1.8.0