wxr
2020-09-11 9b5399d3dd4299563821af0a7131f9a52402feea
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)
@@ -257,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 });
@@ -393,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 发送命令立即更新UI
                HomePage.UpdataFunctionStates(function);
                RoomPage.UpdataStates(function);
                FunctionPage.UpdataStates(function);
                ClassificationPage.UpdataInfo(function);
                #endregion
            }
            catch (Exception ex)
            {