wxr
2023-08-08 884a8ce78b6d198a5878e85fc30cb85177e59826
HDL_ON/Entity/Function/Function.cs
@@ -445,20 +445,52 @@
        /// </summary>
        public bool collect = false;
        private bool _online = false;
        /// <summary>
        /// 是否在线
        /// </summary>
        public bool online
        {
        private bool _online;
        public bool online {
            get
            {
                if (spk == SPK.AirSwitchP3)
                {
                    return _online;
                }
                return true;
            }
            set
            {
                _online = value;
            }
        }
        ///// <summary>
        ///// 是否在线
        ///// </summary>
        //public bool online
        //{
        //    get
        //    {
        //        if(spk == SPK.AirSwitchP3)
        //        {
        //            return _online;
        //        }
        //        return true;
        //    }
        //    set
        //    {
        //        _online = value;
        //    }
        //}
        public bool isOnline()
        {
            if (spk == SPK.AirSwitchP3)
            {
                return online;
            }
            return true;
        }
        public void setOnine(bool isOnline)
        {
            online = isOnline;
        }
        /// <summary>
@@ -813,10 +845,10 @@
                    {
                        foreach (var temp in gc.sids)
                        {
                            var light = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid);
                            if (light != null)
                            var tempDevice = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid);
                            if (tempDevice != null)
                            {
                                foreach (var attr in light.attributes)
                                foreach (var attr in tempDevice.attributes)
                                {
                                    if (list.Find((obj) => obj.key == attr.key) == null)
                                    {
@@ -850,27 +882,54 @@
                    sFunc.type = "5";
                }
                string us = "";
                switch (attr.key)
                {
                    case FunctionAttributeKey.SetTemp:
                        var tt = GetAttribute(FunctionAttributeKey.TempType);
                        if (tt == null)
                        {
                            attr.unit = "°C";
                        }
                        else
                        {
                            if (tt.unit == string.Empty)
                            {
                                attr.unit = "°C";
                            }
                            else
                            {
                                if (tt.unit == "C")
                                {
                                    attr.unit = "°C";
                                }
                                else if (tt.unit == "F")
                                {
                                    attr.unit = "°F";
                                }
                                else
                                {
                                    attr.unit = tt.unit;
                                }
                            }
                        }
                        break;
                    case FunctionAttributeKey.RoomTemp:
                        us = "°C";
                        attr.unit = "°C";
                        var tempType = attributes.Find((obj) => obj.key == FunctionAttributeKey.TempType);
                        if (tempType != null)
                        {
                            us = tempType.curValue.ToString();
                            attr.unit = tempType.curValue.ToString();
                        }
                        break;
                    case FunctionAttributeKey.Percent:
                    case FunctionAttributeKey.Brightness:
                        us = "%";
                        attr.unit = "%";
                        break;
                    case FunctionAttributeKey.CCT:
                        us = "K";
                        attr.unit = "K";
                        break;
                    case FunctionAttributeKey.Angle:
                        us = "°";
                        attr.unit = "°";
                        break;
                }
@@ -934,13 +993,13 @@
                                vv = 26;
                            }
                            sFunc.status.Add(new SceneFunctionStatus() {
                                UintString = us,
                                UintString = attr.unit,
                                key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min }) ;
                        }
                        else
                        {
                            sFunc.status.Add(new SceneFunctionStatus() {
                                UintString = us,
                                UintString = attr.unit,
                                key = attr.key, value = attr.curValue.ToString(), max = attr.max, min = attr.min });
                        }
                        break;
@@ -1088,6 +1147,10 @@
        /// 云端负责生成
        /// </summary>
        public string deviceId = "0";
        /// <summary>
        /// 在线状态
        /// </summary>
        public bool online = true;
        public List<AttributesStatus> status = new List<AttributesStatus>();
    }
    /// <summary>