From a251442d9fc088b3d8cf74d20b959f0f6103b095 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 14 九月 2020 17:42:10 +0800 Subject: [PATCH] 20200914 --- HDL_ON/DriverLayer/Control.cs | 69 ++++++---------------------------- 1 files changed, 13 insertions(+), 56 deletions(-) diff --git a/HDL_ON/DriverLayer/Control.cs b/HDL_ON/DriverLayer/Control.cs index 6f71392..f27acb1 100644 --- a/HDL_ON/DriverLayer/Control.cs +++ b/HDL_ON/DriverLayer/Control.cs @@ -3,6 +3,7 @@ using HDL_ON.DAL; using HDL_ON.DAL.Net; using HDL_ON.Entity; +using HDL_ON.UI; namespace HDL_ON { @@ -13,7 +14,7 @@ /// </summary> public static void Send(Function function) { - switch(function.functionCategory) + switch (function.functionCategory) { case FunctionCategory.Scene: ControlScene(function as Scene); @@ -114,7 +115,7 @@ { curtainState = 1; } - else if (function.trait_on_off.value.ToString() =="off") + else if (function.trait_on_off.value.ToString() == "off") { curtainState = 2; } @@ -154,7 +155,7 @@ case FunctionType.Relay: case FunctionType.Dimmer: byte brightness = 0; - if(function.trait_on_off.value.ToString() == "on") + if (function.trait_on_off.value.ToString() == "on") { var brightnessTrait = function.function.Find((obj) => obj.name == "brightness"); if (brightnessTrait != null) @@ -219,7 +220,6 @@ var deviceId = function.bus_Data.DeviceID; var loopId = function.bus_Data.LoopID; - switch (function.functionCategory) { case FunctionCategory.Light: @@ -258,7 +258,7 @@ ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus_Data.LoopID, b1, - 0, 0 }); + 0, Convert.ToByte(light.fadeTime) }); break; case FunctionType.Relay: ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus_Data.LoopID, light.trait_on_off.value.ToString() == "on" ? (byte)100 : (byte)0, 0, 0 }); @@ -394,55 +394,12 @@ } break; } - - - foreach (var dic in commandDictionary) - { - switch (dic.Key) - { - case "on_off": - break; - case "brightness": - break; - case "color": - break; - default: - MainPage.Log($"鍔熻兘鏈敮鎸� : {dic.Key}"); - break; - //case "cct": - //case "delay": - //case "fade_time": - //case "open_level": - //case "lock": - //case "ico": - //case "mode": - //case "fan": - //case "temp": - //case "swing": - //case "set_ point": - //case "pm25": - //case "volume": - //case "vol_step": - //case "source": - //case "treble": - //case "bass": - //case "playlist": - //case "song_name": - //case "current_status": - //case "enable": - //case "lux": - //case "adjust_value": - //case "range": - //case "humidity": - //case "type": - //case "state": - //case "sensitivity": - //case "pm25value": - } - } - - - + #region 鍙戦�佸懡浠ょ珛鍗虫洿鏂癠I + HomePage.UpdataFunctionStates(function); + RoomPage.UpdataStates(function); + FunctionPage.UpdataStates(function); + ClassificationPage.UpdataInfo(function); + #endregion } catch (Exception ex) { @@ -501,7 +458,7 @@ { case FunctionType.Fan: var fan = function as Fan; - ControlBytesSend(Command.SetSingleLightACK, subnetId, deviceId, new byte[] { fan.bus_Data.LoopID }); + ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { fan.bus_Data.LoopID }); break; } break; @@ -510,7 +467,7 @@ { case FunctionType.Socket: var s = function as SwitchSocket; - ControlBytesSend(Command.SetSingleLightACK, subnetId, deviceId, new byte[] { s.bus_Data.LoopID }); + ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { s.bus_Data.LoopID }); break; } break; -- Gitblit v1.8.0