From bb6ad792b598927a5459a5fb6f6c27fb1aa9e94e Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 17 十二月 2020 14:06:36 +0800 Subject: [PATCH] 20201217-1 --- HDL_ON/Entity/Function/FloorHeating.cs | 88 +++++++++++++++++++++++++++++++------------ 1 files changed, 63 insertions(+), 25 deletions(-) diff --git a/HDL_ON/Entity/Function/FloorHeating.cs b/HDL_ON/Entity/Function/FloorHeating.cs index 3cf3d09..f218595 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, set_temperature, lock] + *鍦扮儹锛歵rait: [switch, mode, set_temp, lock] *灞炴�� 鎻忚堪 *switch on/off *mode day, night,away, vacation, timer - *set_temperature value(鍙) + *set_temp value *lock boolean(Lock閿佸畾鎺у埗) *set_ point up,down,value */ @@ -48,30 +48,33 @@ } } } - 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", "normal", "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] : ""; + if(_trait_mode.curValue.ToString() == "{}") + { + _trait_mode.curValue = "day"; + } } return _trait_mode; } @@ -95,7 +98,7 @@ try { byte index = 0; - switch (trait_mode.value.ToString()) + switch (trait_mode.curValue.ToString()) { case "day": index = 2; @@ -129,22 +132,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; } @@ -157,39 +160,74 @@ /// </summary> public byte timeFlag = 0; + FunctionAttributes _trait_IndoorTemp; /// <summary> /// 瀹ゅ唴娓╁害 /// </summary> [Newtonsoft.Json.JsonIgnore] - public int indoorTemp = 20; + public FunctionAttributes trait_IndoorTemp + { + get + { + if (_trait_IndoorTemp == null) + { + _trait_IndoorTemp = attributes.Find((obj) => obj.key == FunctionAttributeKey.IndoorTemp); + //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� + if (_trait_IndoorTemp == null) + { + _trait_IndoorTemp = new FunctionAttributes() + { + key = FunctionAttributeKey.IndoorTemp, + value = new List<string> { }, + max = 30, + min = 0, + }; + if (_trait_IndoorTemp.curValue.ToString() == "{}") + _trait_IndoorTemp.curValue = 0; + } + } + //if (_trait_IndoorTemp.curValue.ToString().Length > 3) + { + var vv = Convert.ToDouble(_trait_IndoorTemp.curValue); + _trait_IndoorTemp.curValue = Convert.ToInt32(vv); + } + return _trait_IndoorTemp; + } + } - Trait _trait_temp; + FunctionAttributes _trait_temp; /// <summary> /// 褰撳墠娓╁害 /// </summary>/// <summary> /// 褰撳墠绌鸿皟娓╁害 /// </summary> [Newtonsoft.Json.JsonIgnore] - public Trait trait_temp + public FunctionAttributes trait_temp { get { if (_trait_temp == null) { - _trait_temp = function.Find((obj) => obj.name == "set_temperature"); + _trait_temp = attributes.Find((obj) => obj.key == "set_temp"); //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� if (_trait_temp == null) { - _trait_temp = new Trait() + _trait_temp = new FunctionAttributes() { - name = "set_temperature", - value_key = new List<string> { }, + key = "set_temp", + value = new List<string> { }, max = 30, min = 5, }; } - _trait_temp.value = 16; + if(_trait_temp.curValue.ToString() == "{}") + _trait_temp.curValue = 16; + } + //if (_trait_temp.curValue.ToString().Length > 3) + { + var vv = Convert.ToDouble(_trait_temp.curValue); + _trait_temp.curValue = Convert.ToInt32(vv); } return _trait_temp; } @@ -205,7 +243,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