From f4c86f68b900bd506ef7214b2ae9bd23a9d2ffa8 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期六, 19 十二月 2020 17:48:11 +0800
Subject: [PATCH] 完成筛选房间的功能
---
HDL_ON/Entity/Function/FloorHeating.cs | 137 ++++++++++++++++++++++++---------------------
1 files changed, 74 insertions(+), 63 deletions(-)
diff --git a/HDL_ON/Entity/Function/FloorHeating.cs b/HDL_ON/Entity/Function/FloorHeating.cs
old mode 100644
new mode 100755
index d9cf8b3..f218595
--- 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_temp, lock]
*灞炴�� 鎻忚堪
*switch on/off
*mode day, night,away, vacation, timer
- *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", "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] : "";
+ 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,70 +160,78 @@
/// </summary>
public byte timeFlag = 0;
+ FunctionAttributes _trait_IndoorTemp;
/// <summary>
/// 瀹ゅ唴娓╁害
/// </summary>
[Newtonsoft.Json.JsonIgnore]
- public int indoorTemp = 20;
-
-
- Trait _trait_temperature;
- /// <summary>
- /// 褰撳墠娓╁害
- /// </summary>
- [Newtonsoft.Json.JsonIgnore]
- public double curTemp
+ public FunctionAttributes trait_IndoorTemp
{
get
{
- try
+ if (_trait_IndoorTemp == 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_IndoorTemp = attributes.Find((obj) => obj.key == FunctionAttributeKey.IndoorTemp);
//鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
- if (_trait_temperature == null)
+ if (_trait_IndoorTemp == null)
{
- _trait_temperature = new Trait()
+ _trait_IndoorTemp = new FunctionAttributes()
{
- name = "temperature",
- value_key = new List<string>(),
- max = 4,
+ key = FunctionAttributeKey.IndoorTemp,
+ value = new List<string> { },
+ max = 30,
min = 0,
};
+ if (_trait_IndoorTemp.curValue.ToString() == "{}")
+ _trait_IndoorTemp.curValue = 0;
}
- _trait_temperature.value = _trait_temperature.value_key[_trait_temperature.min];
}
- _trait_temperature.value = value;
+ //if (_trait_IndoorTemp.curValue.ToString().Length > 3)
+ {
+ var vv = Convert.ToDouble(_trait_IndoorTemp.curValue);
+ _trait_IndoorTemp.curValue = Convert.ToInt32(vv);
+ }
+ return _trait_IndoorTemp;
}
}
+
+ FunctionAttributes _trait_temp;
+ /// <summary>
+ /// 褰撳墠娓╁害
+ /// </summary>/// <summary>
+ /// 褰撳墠绌鸿皟娓╁害
+ /// </summary>
+ [Newtonsoft.Json.JsonIgnore]
+ public FunctionAttributes trait_temp
+ {
+ get
+ {
+ if (_trait_temp == null)
+ {
+ _trait_temp = attributes.Find((obj) => obj.key == "set_temp");
+ //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂��
+ if (_trait_temp == null)
+ {
+ _trait_temp = new FunctionAttributes()
+ {
+ key = "set_temp",
+ value = new List<string> { },
+ max = 30,
+ min = 5,
+ };
+ }
+ 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;
+ }
+ }
/// <summary>
/// 褰撳墠妯″紡鐨刬con璺緞
/// </summary>
@@ -232,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