wxr
2020-11-20 e2ffb5fce53119f5cb36e3b2466becbefa096842
HDL_ON/Entity/Function/Function.cs
@@ -219,8 +219,10 @@
            {
                var findRoom = DB_ResidenceData.rooms.Find(obj => obj.sid == roomId);
                if (findRoom == null)
                {
                    continue;
                if(roomNameList != "")
                }
                if (roomNameList != "")
                {
                    roomNameList += ",";
                }
@@ -246,6 +248,65 @@
        /// 更新时间
        /// </summary>
        public DateTime refreshTime = DateTime.MinValue;
        /// <summary>
        /// 获取控制发送数据
        /// </summary>
        public AprotocolControlObj GetControlSendData(Dictionary<string, string> commandDictionary)
        {
            var sendDataObj = new AprotocolControlObj();
            sendDataObj.from_oid = "";
            sendDataObj.to_oid = "";
            sendDataObj.time_stamp = "";
            sendDataObj.type = "device_sid";
            sendDataObj.command = "write";
            var acoList = new AprotocolControlData();
            acoList.sid = sid;
            var aco = new AprotocolControlAttribute();
            foreach(var dic in commandDictionary)
            {
                aco.name = dic.Key;
                aco.value = dic.Value;
                acoList.function.Add(aco);
            }
            sendDataObj.objects.Add(acoList);
            return sendDataObj;
        }
    }
    /// <summary>
    /// A协议控制数据的对象
    /// </summary>
    public class AprotocolControlObj
    {
        public List<AprotocolControlData> objects = new List<AprotocolControlData>();
        public string from_oid = "";
        public string to_oid = "";
        public string time_stamp = "";
        public string type = "";
        public string command = "";
    }
    /// <summary>
    /// A协议控制数据
    /// </summary>
    public class AprotocolControlData
    {
        public string sid = "";
        public List<AprotocolControlAttribute> function = new List<AprotocolControlAttribute>();
    }
    /// <summary>
    /// A协议控制属性对象
    /// </summary>
    public class AprotocolControlAttribute
    {
        public string name;
        public string value;
    }
    /// <summary>
@@ -258,22 +319,10 @@
        /// 属性名称
        /// </summary>
        public string name;
        List<string> _value_key;
        /// <summary>
        /// 属性的值列表
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public List<string> value_key
        {
            get
            {
                return _value_key;
            }
            set
            {
                _value_key = value;
            }
        }
        public List<string> value_key = new List<string>();
        /// <summary>
        /// 最大值
        /// </summary>
@@ -312,6 +361,7 @@
                switch (name)
                {
                    case "temperature":
                    case "set_temperature":
                        us = "°C";
                        break;
                    case "percent":
@@ -351,6 +401,7 @@
                        text = Language.StringByID(StringId.FanSpeed);
                        break;
                    case "temperature":
                case "set_temperature":
                        text = Language.StringByID(StringId.Temp);
                        break;
                    case "delay":
@@ -366,7 +417,7 @@
                        //case "lock":
                        //case "ico":
                        //case "swing":
                        //case "set_ point":
                        //case "set_point":
                        //case "pm25":
                        //case "volume":
                        //case "vol_step":
@@ -413,6 +464,7 @@
                    text = value == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF);
                    break;
                case "temperature":
                case "set_temperature":
                case "brightness":
                case "percent":
                    if (value == "")
@@ -521,7 +573,7 @@
                //case "lock":
                //case "ico":
                //case "swing":
                //case "set_ point":
                //case "set_point":
                //case "pm25":
                //case "volume":
                //case "vol_step":