From 0f2e0147e8990e913d16d99bc1b94fb6bc53abd7 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 03 十二月 2020 15:35:42 +0800
Subject: [PATCH] 2020-12-03-1

---
 HDL_ON/Entity/Function/FloorHeating.cs |   89 +++++++++++++++-----------------------------
 1 files changed, 31 insertions(+), 58 deletions(-)

diff --git a/HDL_ON/Entity/Function/FloorHeating.cs b/HDL_ON/Entity/Function/FloorHeating.cs
index d9cf8b3..f4f8407 100644
--- a/HDL_ON/Entity/Function/FloorHeating.cs
+++ b/HDL_ON/Entity/Function/FloorHeating.cs
@@ -6,11 +6,11 @@
     public class FloorHeating : Function
     {
         /*
-        *鍦扮儹锛歵rait: [switch, mode, temperature, lock]
+        *鍦扮儹锛歵rait: [switch, mode, set_temperature, lock]
         *灞炴�� 鎻忚堪
         *switch	on/off
         *mode    day, night,away, vacation, timer
-        *temperature value(鍙)
+        *set_temperature value(鍙)
         *lock	boolean(Lock閿佸畾鎺у埗)
         *set_ point	up,down,value
         */
@@ -48,30 +48,30 @@
                 }
             }
         }
-        Trait _trait_mode;
+        FunctionAttributes _trait_mode;
         /// <summary>
         /// 妯″紡灞炴��
         /// </summary>
         [Newtonsoft.Json.JsonIgnore]
-        public Trait trait_mode
+        public FunctionAttributes trait_mode
         {
             get
             {
                 if (_trait_mode == null)
                 {
-                    _trait_mode = function.Find((obj) => obj.name == "mode");
+                    _trait_mode = attributes.Find((obj) => obj.key == "mode");
                     //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
                     if (_trait_mode == null)
                     {
-                        _trait_mode = new Trait()
+                        _trait_mode = new FunctionAttributes()
                         {
-                            name = "mode",
-                            value_key = new List<string> { "day", "night", "away", "vacation", "timer" },
+                            key = "mode",
+                            value = new List<string> { "day", "night", "away", "normal", "timer" },
                             max = 4,
                             min = 0,
                         };
                     }
-                    _trait_mode.value = _trait_mode.value_key.Count > 0 ? _trait_mode.value_key[0] : "";
+                    _trait_mode.curValue = _trait_mode.value.Count > 0 ? _trait_mode.value[0] : "";
                 }
                 return _trait_mode;
             }
@@ -95,7 +95,7 @@
                 try
                 {
                     byte index = 0;
-                    switch (trait_mode.value.ToString())
+                    switch (trait_mode.curValue.ToString())
                     {
                         case "day":
                             index = 2;
@@ -129,22 +129,22 @@
                 switch (value)
                 {
                     case 5:
-                        trait_mode.value = "timer";
+                        trait_mode.curValue = "timer";
                         break;
                     case 1:
-                        trait_mode.value = "normal";
+                        trait_mode.curValue = "normal";
                         break;
                     case 2:
-                        trait_mode.value = "day";
+                        trait_mode.curValue = "day";
                         break;
                     case 3:
-                        trait_mode.value = "night";
+                        trait_mode.curValue = "night";
                         break;
                     case 4:
-                        trait_mode.value = "away";
+                        trait_mode.curValue = "away";
                         break;
                     default:
-                        trait_mode.value = "cool";
+                        trait_mode.curValue = "cool";
                         break;
 
                 }
@@ -164,63 +164,36 @@
         public int indoorTemp = 20;
 
 
-        Trait _trait_temperature;
+        FunctionAttributes _trait_temp;
         /// <summary>
         /// 褰撳墠娓╁害
+        /// </summary>/// <summary>
+        /// 褰撳墠绌鸿皟娓╁害
         /// </summary>
         [Newtonsoft.Json.JsonIgnore]
-        public double curTemp
+        public FunctionAttributes trait_temp
         {
             get
             {
-                try
+                if (_trait_temp == null)
                 {
-                    if (_trait_temperature == null)
-                    {
-                        _trait_temperature = function.Find((obj) => obj.name == "temperature");
-                        //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
-                        if (_trait_temperature == null)
-                        {
-                            _trait_temperature = new Trait()
-                            {
-                                name = "temperature",
-                                value_key = new List<string>(),
-                                max = 32,
-                                min = 5,
-                            };
-                        }
-                        _trait_temperature.value = 5;
-                    }
-                    return 5;
-                }
-                catch (Exception ex)
-                {
-                    MainPage.Log($"ac get temp error : {ex.Message}");
-                    return 5;
-                }
-            }
-            set
-            {
-                if (_trait_temperature == null)
-                {
-                    _trait_temperature = function.Find((obj) => obj.name == "temperature");
+                    _trait_temp = attributes.Find((obj) => obj.key == "set_temperature");
                     //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
-                    if (_trait_temperature == null)
+                    if (_trait_temp == null)
                     {
-                        _trait_temperature = new Trait()
+                        _trait_temp = new FunctionAttributes()
                         {
-                            name = "temperature",
-                            value_key = new List<string>(),
-                            max = 4,
-                            min = 0,
+                            key = "set_temperature",
+                            value = new List<string> { },
+                            max = 30,
+                            min = 5,
                         };
                     }
-                    _trait_temperature.value = _trait_temperature.value_key[_trait_temperature.min];
+                    _trait_temp.curValue = 16;
                 }
-                _trait_temperature.value = value;
+                return _trait_temp;
             }
         }
-
         /// <summary>
         /// 褰撳墠妯″紡鐨刬con璺緞
         /// </summary>
@@ -232,7 +205,7 @@
                 try
                 {
                     var imagePath = "FunctionIcon/AC/HeatingIcon.png";
-                    switch (trait_mode.value)
+                    switch (trait_mode.curValue)
                     {
                         case "day":
                             imagePath = "FunctionIcon/AC/HeatingIcon.png";

--
Gitblit v1.8.0