From 6a9ad7ec93218913a2ce3b898bb036f18f8f0da4 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 13 八月 2020 17:06:36 +0800
Subject: [PATCH] 20200813

---
 HDL_ON/DriverLayer/CommonPage.cs |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 58 insertions(+), 1 deletions(-)

diff --git a/HDL_ON/DriverLayer/CommonPage.cs b/HDL_ON/DriverLayer/CommonPage.cs
index d12e95e..53c7dff 100644
--- a/HDL_ON/DriverLayer/CommonPage.cs
+++ b/HDL_ON/DriverLayer/CommonPage.cs
@@ -119,7 +119,6 @@
 
                 switch (command)
                 {
-                    case Command.ReadLightSingleLoopBrightnessACK:
                     case Command.SetSingleLightACK:
                         foreach (var light in DB_ResidenceData.residenceData.functionList.lights)
                         {
@@ -181,6 +180,64 @@
                         }
 
                         break;
+                    case Command.ReadLightAllLoopBrightnessACK:
+                        for (int i = 0; i < receiveBytes[0]; i++)
+                        {
+                            var light = DB_ResidenceData.residenceData.functionList.lights.Find((obj) => obj.bus_Data.SubnetID == subnetID && obj.bus_Data.DeviceID == deviceID && obj.bus_Data.LoopID == i);
+                            if (light != null)
+                            {
+                                if (light.functionType != FunctionType.RGB)
+                                {
+                                    light.on_off = receiveBytes[2] == 0 ? "off" : "on";
+                                    if (light.on_off == "on")
+                                    {
+                                        light.brightness = receiveBytes[2];
+                                        light.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%";
+                                    }
+                                    HomePage.UpdataFunctionStates(light);
+                                    RoomPage.UpdataStates(light);
+                                    FunctionPage.UpdataStates(light);
+                                    ClassificationPage.UpdataInfo(light);
+                                    switch (light.functionType)
+                                    {
+                                        case FunctionType.Relay:
+                                            RelayPage.UpdataState(light);
+                                            break;
+                                        case FunctionType.Dimmer:
+                                            DimmerPage.UpdataStates(light);
+                                            break;
+                                    }
+                                }
+                            }
+                            else
+                            {
+                                var e = DB_ResidenceData.residenceData.functionList.electricals.Find((obj) => obj.bus_Data.SubnetID == subnetID && obj.bus_Data.DeviceID == deviceID && obj.bus_Data.LoopID == i);
+                                if (e != null)
+                                {
+                                    var fan = e as Fan;
+                                    fan.on_off = receiveBytes[2] == 0 ? "off" : "on";
+                                    if (fan.on_off == "on")
+                                    {
+                                        fan.openLevel = receiveBytes[2];
+                                        fan.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2];
+                                    }
+                                    HomePage.UpdataFunctionStates(fan);
+                                    RoomPage.UpdataStates(fan);
+                                    FunctionPage.UpdataStates(fan);
+                                    ClassificationPage.UpdataInfo(fan);
+                                    switch (fan.functionType)
+                                    {
+                                        case FunctionType.Fan:
+                                            FanPage.UpdataState(fan);
+                                            break;
+                                        case FunctionType.Socket:
+
+                                            break;
+                                    }
+                                }
+                            }
+                        }
+                        break;
                     case Command.SetLogicLoopColorACK:
                     case Command.ReadLogicLoopColorACK:
                         foreach (var rgb in DB_ResidenceData.residenceData.functionList.lights)

--
Gitblit v1.8.0