wxr
2020-08-11 2bec9c838d2d688025698de8ec1de401ffd7dd1f
HDL_ON/DriverLayer/CommonPage.cs
@@ -115,6 +115,7 @@
                {
                }
                Control.controlLostCount = 0;
                switch (command)
                {
@@ -124,7 +125,7 @@
                        {
                            if (light.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                            {
                                if ( light.functionType != FunctionType.RGB)
                                if (light.functionType != FunctionType.RGB)
                                {
                                    light.on_off = receiveBytes[2] == 0 ? "off" : "on";
                                    if (light.on_off == "on")
@@ -189,7 +190,7 @@
                                if (rgb.functionType == FunctionType.RGB)
                                {
                                    rgb.on_off = receiveBytes[1] > 0 ? "on" : "off";
                                    if (receiveBytes[1] >0)
                                    if (receiveBytes[1] > 0)
                                    {
                                        rgb.brightness = receiveBytes[1];
                                        rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%";
@@ -321,11 +322,11 @@
                            if (fh.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                            {
                                fh.curTempType = receiveBytes[2];
                                fh.on_off = receiveBytes[1] % 2 ==0?"off":"on";
                                fh.on_off = receiveBytes[1] % 2 == 0 ? "off" : "on";
                                fh.curModeIndex = receiveBytes[3];
                                if (fh.modeTemp.ContainsKey("ordinary"))
                                {
                                    fh.modeTemp["ordinary"]= receiveBytes[4];
                                    fh.modeTemp["ordinary"] = receiveBytes[4];
                                }
                                else
                                {
@@ -370,9 +371,10 @@
                                        break;
                                    case "timer":
                                        fh.lastState = Language.StringByID(StringId.Auto);
                                        if(receiveBytes[8]==0)
                                        if (receiveBytes[8] == 0)
                                        {
                                        }else
                                        }
                                        else
                                        {
                                        }
                                        break;
@@ -434,11 +436,11 @@
                                if ((int)sensor.functionType % 256 == receiveBytes[1] && sensor.bus_Data.SubnetID == subnetID &&
                                    sensor.bus_Data.DeviceID == deviceID && sensor.bus_Data.LoopID == receiveBytes[2])
                                {
                                    //0保留   1无符号4Byte整形  2有符号4Byte整形  3Float形(代±)
                                    //0保留 1无符号4Byte整形  2有符号4Byte整形  3Float形(代±)
                                    switch (receiveBytes[3])
                                    {
                                        case 1:
                                            sensor.values = (receiveBytes[5]*256 * 256 * 256)+ (receiveBytes[6] * 256 * 256)+ (receiveBytes[7] * 256)+ receiveBytes[8];
                                            sensor.values = (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8];
                                            break;
                                        case 2:
                                            sensor.values = -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]);
@@ -460,6 +462,104 @@
                            }
                        }
                        break;
                    case Command.InstructionPanelKeyACK:
                    case Command.ReadInstructionPanelKeyACK:
                        byte reACPanel = 0;
                        if (receiveBytes.Length == 2)
                        {
                            reACPanel = 1;
                        }
                        else if (receiveBytes.Length == 3)
                        {
                            reACPanel = receiveBytes[2];
                        }
                        else
                        {
                            break;
                        }
                        foreach (var ac in DB_ResidenceData.residenceData.functionList.aCs)
                        {
                            if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + reACPanel)
                            {
                                switch (receiveBytes[0])
                                {
                                    case 3://
                                        ac.on_off = receiveBytes[1] == 1 ? "on" : "off";
                                        break;
                                    case 4:
                                    case 7:
                                    case 8:
                                    case 19:
                                        ac.curTemp = receiveBytes[1];
                                        break;
                                    case 5:
                                        ac.curFanIndex = receiveBytes[1];
                                        break;
                                    case 6:
                                        ac.curModeIndex = receiveBytes[1];
                                        break;
                                }
                                ac.lastState = "";
                                ac.lastState += " " + ac.curTemp + ac.curTempTypeString;
                                RoomPage.UpdataStates(ac);
                                FunctionPage.UpdataStates(ac);
                                HomePage.UpdataFunctionStates(ac);
                                ClassificationPage.UpdataInfo(ac);
                                ACPage.UpdataStates(ac);
                                //else if (common.Type == DeviceType.FoolHeatPanel)
                                {
                                    //switch (receiveBytes[0])
                                    //{
                                    //    case 20://
                                    //        fh.Status = receiveBytes[1];
                                    //        break;
                                    //    case 21:
                                    //        fh.TemperatureType = receiveBytes[1];
                                    //        if (receiveBytes[1] == 5)
                                    //        {
                                    //            if (fh.Timer == 0)//时间模式的时间段标志 (0:白天,1:夜晚) (1byte)     //20110112加时间段标志
                                    //                Control.ControlBytesSend(Command.ReadInstructionPanelKey, fh.SubnetID, fh.DeviceID, new byte[] { 26, 2, fh.LoopID }, SendCount.Zero);
                                    //            else
                                    //                Control.ControlBytesSend(Command.ReadInstructionPanelKey, fh.SubnetID, fh.DeviceID, new byte[] { 27, 3, fh.LoopID }, SendCount.Zero);
                                    //        }
                                    //        else
                                    //            Control.ControlBytesSend(Command.ReadInstructionPanelKey, fh.SubnetID, fh.DeviceID, new byte[] { (byte)(receiveBytes[1] + 24), fh.LoopID }, SendCount.Zero);
                                    //        break;
                                    //    case 25:
                                    //        fh.NormalTemperature = receiveBytes[1];
                                    //        break;
                                    //    case 26:
                                    //        fh.DayTemperature = receiveBytes[1];
                                    //        break;
                                    //    case 27:
                                    //        fh.NightTemperature = receiveBytes[1];
                                    //        break;
                                    //    case 28:
                                    //        fh.AwayTemperature = receiveBytes[1];
                                    //        break;
                                    //}
                                }
                            }
                        }
                        break;
                    case Command.ReadPanleTempACK://1944
                    case Command.PanleBroadcastTemp:
                        foreach (var ac in DB_ResidenceData.residenceData.functionList.aCs)
                        {
                            if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                            {
                                ac.indoorTemp = receiveBytes[1];
                                FunctionPage.UpdataStates(ac);
                            }
                            //else if (common.Type == DeviceType.FoolHeatPanel)
                            //    {
                            //        var tempFH22 = common as FoolHeatPanel;
                            //        tempFH22.IndoorTemperature = receiveBytes[1];
                            //        UserFHPage.UpdateIndoorTemp(tempFH22.CommonLoopID, receiveBytes[1]);
                            //    }
                        }
                        break;
                }
            }
            catch (Exception ex)