From ea318e20d9a513bfae81a9203cef4bca0fc23c2c Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 30 九月 2020 11:01:15 +0800
Subject: [PATCH] 202009301
---
HDL_ON/Entity/Function/FloorHeating.cs | 230 +++++++++++++++------------------------------------------
1 files changed, 62 insertions(+), 168 deletions(-)
diff --git a/HDL_ON/Entity/Function/FloorHeating.cs b/HDL_ON/Entity/Function/FloorHeating.cs
index f5bb84e..3cf3d09 100644
--- a/HDL_ON/Entity/Function/FloorHeating.cs
+++ b/HDL_ON/Entity/Function/FloorHeating.cs
@@ -6,12 +6,13 @@
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 up,down,value
+ *set_temperature value(鍙)
*lock boolean(Lock閿佸畾鎺у埗)
+ *set_ point up,down,value
*/
public FloorHeating()
{
@@ -33,7 +34,7 @@
/// <summary>
/// 褰撳墠娓╁害妯″紡瀛楃
/// </summary>
- public string curTempTypeString
+ public string tempUnitString
{
get
{
@@ -47,20 +48,46 @@
}
}
}
+ Trait _trait_mode;
/// <summary>
- /// 褰撳墠妯″紡
+ /// 妯″紡灞炴��
/// </summary>
[Newtonsoft.Json.JsonIgnore]
- public string curMode = "day";
+ public Trait trait_mode
+ {
+ get
+ {
+ if (_trait_mode == null)
+ {
+ _trait_mode = function.Find((obj) => obj.name == "mode");
+ //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
+ if (_trait_mode == null)
+ {
+ _trait_mode = new Trait()
+ {
+ name = "mode",
+ value_key = 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] : "";
+ }
+ return _trait_mode;
+ }
+ }
+
/// <summary>
/// 宸ヤ綔妯″紡瀵瑰簲鐨勫伐浣滄俯搴�
/// </summary>
+ [Newtonsoft.Json.JsonIgnore]
public Dictionary<string, byte> modeTemp = new Dictionary<string, byte>();
/// <summary>
/// 褰撳墠妯″紡绱㈠紩
/// bus鎺у埗鍛戒护浣跨敤
/// </summary>
+ [Newtonsoft.Json.JsonIgnore]
public byte curModeIndex
{
get
@@ -68,7 +95,7 @@
try
{
byte index = 0;
- switch (curMode)
+ switch (trait_mode.value.ToString())
{
case "day":
index = 2;
@@ -79,7 +106,7 @@
case "away":
index = 4;
break;
- case "ordinary":
+ case "normal":
index = 1;
break;
case "timer":
@@ -102,62 +129,24 @@
switch (value)
{
case 5:
- curMode = "timer";
+ trait_mode.value = "timer";
break;
case 1:
- curMode = "ordinary";
+ trait_mode.value = "normal";
break;
case 2:
- curMode = "day";
+ trait_mode.value = "day";
break;
case 3:
- curMode = "night";
+ trait_mode.value = "night";
break;
case 4:
- curMode = "away";
+ trait_mode.value = "away";
break;
default:
- curMode = "cool";
+ trait_mode.value = "cool";
break;
- }
- }
- }
-
- [Newtonsoft.Json.JsonIgnore]
- public Trait trait_mode;
- /// <summary>
- /// 妯″紡鍒楄〃
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public List<string> modeList
- {
- get
- {
- try
- {
- if (trait_mode == null)
- {
- trait_mode = propertList.Find((obj) => obj.attri == "mode");
- //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (trait_mode == null)
- {
- trait_mode = new Trait()
- {
- attri = "mode",
- value = new List<string> { "day", "night", "away", "timer", "ordinary" },
- max = 4,
- min = 0,
- };
- }
- trait_mode.curValues = trait_mode.value[trait_mode.min];
- }
- return trait_mode.value;
- }
- catch (Exception ex)
- {
- MainPage.Log($"ac get mode error : {ex.Message}");
- return new List<string> { "day", "night", "away", "timer", "ordinary" };
}
}
}
@@ -173,133 +162,38 @@
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public int indoorTemp = 20;
+
+
+ Trait _trait_temp;
/// <summary>
/// 褰撳墠娓╁害
+ /// </summary>/// <summary>
+ /// 褰撳墠绌鸿皟娓╁害
/// </summary>
[Newtonsoft.Json.JsonIgnore]
- public int curTemp
+ public Trait trait_temp
{
get
{
- switch (curMode)
+ if (_trait_temp == null)
{
- case "day":
- if (!modeTemp.ContainsKey("day"))
+ _trait_temp = function.Find((obj) => obj.name == "set_temperature");
+ //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
+ if (_trait_temp == null)
+ {
+ _trait_temp = new Trait()
{
- modeTemp.Add("day", 20);
- }
- return modeTemp["day"];
- case "night":
- if (!modeTemp.ContainsKey("night"))
- {
- modeTemp.Add("night", 20);
- }
- return modeTemp["night"];
- case "away":
- if (!modeTemp.ContainsKey("away"))
- {
- modeTemp.Add("away", 20);
- }
- return modeTemp["away"];
- case "ordinary":
- if (!modeTemp.ContainsKey("ordinary"))
- {
- modeTemp.Add("ordinary", 20);
- }
- return modeTemp["ordinary"];
- case "timer":
- if (timeFlag == 0)
- {
- if (!modeTemp.ContainsKey("day"))
- {
- modeTemp.Add("day", 20);
- }
- return modeTemp["day"];
- }
- else
- {
- if (!modeTemp.ContainsKey("night"))
- {
- modeTemp.Add("night", 20);
- }
- return modeTemp["night"];
- }
+ name = "set_temperature",
+ value_key = new List<string> { },
+ max = 30,
+ min = 5,
+ };
+ }
+ _trait_temp.value = 16;
}
- return 20;
- }
- set
- {
- switch (curMode)
- {
- case "day":
- if (!modeTemp.ContainsKey("day"))
- {
- modeTemp.Add("day", (byte)value);
- }
- else
- {
- modeTemp["day"] = (byte)value;
- }
- return;
- case "night":
- if (!modeTemp.ContainsKey("night"))
- {
- modeTemp.Add("night", (byte)value);
- }
- else
- {
- modeTemp["night"] = (byte)value;
- }
- break;
- case "away":
- if (!modeTemp.ContainsKey("away"))
- {
- modeTemp.Add("away", (byte)value);
- }
- else
- {
- modeTemp["away"] = (byte)value;
- }
- break;
- case "ordinary":
- if (!modeTemp.ContainsKey("ordinary"))
- {
- modeTemp.Add("ordinary", (byte)value);
- }
- else
- {
- modeTemp["ordinary"] = (byte)value;
- }
- break;
- case "timer":
- if (timeFlag == 0)
- {
- if (!modeTemp.ContainsKey("day"))
- {
- modeTemp.Add("day", (byte)value);
- }
- else
- {
- modeTemp["day"] = (byte)value;
- }
- }
- else
- {
- if (!modeTemp.ContainsKey("night"))
- {
- modeTemp.Add("night", (byte)value);
- }
- else
- {
- modeTemp["night"] = (byte)value;
- }
- }
- break;
- }
+ return _trait_temp;
}
}
-
-
/// <summary>
/// 褰撳墠妯″紡鐨刬con璺緞
/// </summary>
@@ -311,7 +205,7 @@
try
{
var imagePath = "FunctionIcon/AC/HeatingIcon.png";
- switch (curMode)
+ switch (trait_mode.value)
{
case "day":
imagePath = "FunctionIcon/AC/HeatingIcon.png";
@@ -325,7 +219,7 @@
case "timer":
imagePath = "FunctionIcon/AC/AutoIcon.png";
break;
- case "ordinary":
+ case "normal":
imagePath = "FunctionIcon/FloorHeating/OrdinaryIcon.png";
break;
default:
--
Gitblit v1.8.0