wei
2021-03-26 f369d0b710357c933ed96e73fd337d22906bb0c8
HDL_ON/DAL/DriverLayer/Control_Udp.cs
@@ -694,7 +694,59 @@
                        }
                        break;
                    case FunctionCategory.AirFresh:
                        switch(function.spk)
                        {
                            case SPK.AirFreshJinmao:
                                //1   新风编号    1~200
                                //2   类型 第三方类型  0:金茂新风
                                //3   开关  0 - 关机,1 - 开机
                                //4   运行模式    1 - 通风,2 - 加湿
                                byte airFreshMode = 1;
                                if (function.GetAttrState(FunctionAttributeKey.Mode) == "fan")
                                {
                                    airFreshMode = 2;
                                }
                                //5   节能舒适选择  1 - 舒适,2 - 节能
                                byte airFreshEnergy = 1;
                                 if(   function.GetAttrState(FunctionAttributeKey.Energy)=="true")
                                {
                                    airFreshEnergy = 2;
                                }
                                //6   风速档位    0 - 自动,1 - 1档,2 - 2档,3 - 3档
                                byte airFreshFan = 0;
                                switch(function.GetAttrState(FunctionAttributeKey.FanSpeed))
                                {
                                    case "auto":
                                        airFreshFan = 0;
                                        break;
                                    case "level_1":
                                        airFreshFan = 1;
                                        break;
                                    case "level_2":
                                        airFreshFan = 2;
                                        break;
                                    case "level_3":
                                        airFreshFan = 3;
                                        break;
                                }
                                //7   湿度设定 %
                                //8   室内温度值   ℃
                                //9   室内湿度值   ℃
                                //10  过滤网剩余 %
                                //11  过滤网使用超时 1 超时 0 无
                                ControlBytesSend(Command.FreshAirControl_JinMao, subnetId, deviceId, new byte[] {
                                    function.bus.LoopId,0, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0 ,
                                    airFreshMode,airFreshEnergy,
                                    airFreshFan,
                                    Convert.ToByte( function.GetAttrState(FunctionAttributeKey.Humidity)),
                                    0,0,0,0
                                    //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.IndoorTemp)),
                                    //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.IndoorHumidity)),
                                    //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.FilterRemain)),
                                    //function.GetAttrState(FunctionAttributeKey.FilterTimeout) =="true"?1:0,
                                });
                                break;
                        }
                        break;
                }
                #region 发送命令立即更新UI
@@ -797,6 +849,14 @@
                        }
                        ControlBytesSend(Command.ReadDeviceLoopInfo, subnetId, deviceId, new byte[] { 5, sensorType, function.bus.LoopId });
                        break;
                    case FunctionCategory.AirFresh:
                        switch(function.spk)
                        {
                            case SPK.AirFreshJinmao:
                                ControlBytesSend(Command.FreshAirRead_JinMao, subnetId, deviceId, new byte[] { function.bus.LoopId });
                                break;
                        }
                        break;
                }
            }
            catch (Exception ex)