xm
2021-12-01 6d73bf6e816570291865674bef8bce8972e4de3f
HDL_ON/DAL/DriverLayer/Packet.cs
@@ -133,11 +133,12 @@
                            {
                                if (updataObj.spk != SPK.LightRGB)
                                {
                                    updataObj.trait_on_off.curValue = receiveBytes[2] > 0 ? "on" : "off";
                                    updataObj.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] > 0 ? "on" : "off");
                                    if (updataObj.trait_on_off.curValue.ToString() == "on")
                                    {
                                        switch (updataObj.spk)
                                        {
                                            case SPK.HvacFan:
                                            case SPK.ElectricFan:
                                                updataObj.SetAttrState(FunctionAttributeKey.OpenLevel, receiveBytes[2].ToString());
                                                updataObj.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2];
@@ -160,6 +161,7 @@
                                        case SPK.LightDimming:
                                            DimmerPage.UpdataStates(updataObj);
                                            break;
                                        case SPK.HvacFan:
                                        case SPK.ElectricFan:
                                            FanPage.UpdataState(updataObj);
                                            break;
@@ -177,7 +179,7 @@
                            {
                                if (light.spk != SPK.LightRGB)
                                {
                                    light.trait_on_off.curValue = receiveBytes[light.bus.LoopId] == 0 ? "off" : "on";
                                    light.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[light.bus.LoopId] == 0 ? "off" : "on");
                                    if (light.trait_on_off.curValue.ToString() == "on")
                                    {
                                        light.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[i+1].ToString());
@@ -216,9 +218,11 @@
                                    switch (function.spk)
                                    {
                                        case SPK.ElectricFan:
                                        case SPK.HvacFan:
                                            FanPage.UpdataState(function);
                                            break;
                                        case SPK.ElectricSocket:
                                        case SPK.PanelSocket:
                                            SocketPage.UpdataState(function);
                                            break;
                                    }
@@ -234,7 +238,7 @@
                            {
                                if (lightTeme.spk == SPK.LightRGB)
                                {
                                    lightTeme.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off";
                                    lightTeme.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] > 0 ? "on" : "off");
                                    if (receiveBytes[1] > 0)
                                    {
                                        lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString());
@@ -249,7 +253,7 @@
                                    RGBPage.UpdataStates(lightTeme);
                                }else if(lightTeme.spk == SPK.LightCCT)
                                {
                                    lightTeme.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off";
                                    lightTeme.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] > 0 ? "on" : "off");
                                    if (receiveBytes[1] > 0)
                                    {
                                        lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString());
@@ -276,11 +280,11 @@
                                {
                                    if (receiveBytes[1] > 1)
                                    {
                                        curtain.trait_on_off.curValue = "on";
                                        curtain.SetAttrState(FunctionAttributeKey.OnOff, "on");
                                    }
                                    else
                                    {
                                        curtain.trait_on_off.curValue = "off";
                                        curtain.SetAttrState(FunctionAttributeKey.OnOff, "off");
                                    }
                                    curtain.SetAttrState(FunctionAttributeKey.Percent, receiveBytes[1].ToString());
                                    curtain.lastState = Language.StringByID(StringId.Open) + curtain.GetAttrState(FunctionAttributeKey.Percent) + "%";
@@ -292,14 +296,15 @@
                                    switch (receiveBytes[1])
                                    {
                                        case 0:
                                            curtain.trait_on_off.curValue = "stop";
                                            break;
                                            curtain.SetAttrState(FunctionAttributeKey.OnOff, "stop");
                                            return;
                                        case 1:
                                            curtain.trait_on_off.curValue = "on";
                                            curtain.SetAttrState(FunctionAttributeKey.OnOff, "on");
                                            //curtain.
                                            curtain.lastState = Language.StringByID(StringId.Open);
                                            break;
                                        case 2:
                                            curtain.trait_on_off.curValue = "off";
                                            curtain.SetAttrState(FunctionAttributeKey.OnOff, "off");
                                            curtain.lastState = Language.StringByID(StringId.Close);
                                            break;
                                    }
@@ -332,7 +337,7 @@
                            {
                                function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString());
                                function.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[2].ToString());
                                function.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off";
                                function.SetAttrState(FunctionAttributeKey.OnOff,  receiveBytes[8] == 1 ? "on" : "off");
                                acFunction.SetMode(receiveBytes[9],function);
                                acFunction.SetFan(receiveBytes[10],function);
                                function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[11].ToString());
@@ -375,7 +380,8 @@
                                FunctionPage.UpdataStates(function);
                                HomePage.UpdataFunctionStates(function);
                                ClassificationPage.UpdataInfo(function);
                                ACPage.UpdataStates(function);
                                Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status);
                            }
                        }
                        break;
@@ -386,7 +392,7 @@
                            if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                            {
                                function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[2]);
                                function.trait_on_off.curValue = receiveBytes[1] % 2 == 0 ? "off" : "on";
                                function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] % 2 == 0 ? "off" : "on");
                                new FloorHeating().SetModeIndex(receiveBytes[3],function);
                                if (function.Fh_Mode_Temp.ContainsKey("normal"))
@@ -630,7 +636,7 @@
                                switch (receiveBytes[0])
                                {
                                    case 3://
                                        function.trait_on_off.curValue = receiveBytes[1] == 1 ? "on" : "off";
                                        function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] == 1 ? "on" : "off");
                                        break;
                                    case 4:
                                    case 7:
@@ -652,7 +658,7 @@
                                FunctionPage.UpdataStates(function);
                                HomePage.UpdataFunctionStates(function);
                                ClassificationPage.UpdataInfo(function);
                                ACPage.UpdataStates(function);
                                Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status);
                            }
                        }
                        break;