using System;
|
using System.Collections.Generic;
|
|
namespace HDL_ON.Entity
|
{
|
public class FloorHeating : Function
|
{
|
/*
|
*地热:trait: [switch, mode, set_temperature, lock]
|
*属性 描述
|
*switch on/off
|
*mode day, night,away, vacation, timer
|
*set_temperature value(只读)
|
*lock boolean(Lock锁定控制)
|
*set_ point up,down,value
|
*/
|
public FloorHeating()
|
{
|
}
|
/// <summary>
|
/// 当前温度模式
|
/// 0:摄氏度
|
/// 1:华氏度
|
/// </summary>
|
[Newtonsoft.Json.JsonIgnore]
|
public int curTempType = 0;
|
|
/// <summary>
|
/// 工作模式
|
/// 0:地热模式;1:地冷模式;
|
/// 2:地热功率模式;3:地冷功率模式;
|
/// </summary>
|
public int workMode = 0;
|
/// <summary>
|
/// 当前温度模式字符
|
/// </summary>
|
public string tempUnitString
|
{
|
get
|
{
|
if (curTempType == 0)
|
{
|
return "°C";
|
}
|
else
|
{
|
return "°F";
|
}
|
}
|
}
|
FunctionAttributes _trait_mode;
|
/// <summary>
|
/// 模式属性
|
/// </summary>
|
[Newtonsoft.Json.JsonIgnore]
|
public FunctionAttributes trait_mode
|
{
|
get
|
{
|
if (_trait_mode == null)
|
{
|
_trait_mode = function.Find((obj) => obj.key == "mode");
|
//找不到属性需要声明一个,防止报错闪退
|
if (_trait_mode == null)
|
{
|
_trait_mode = new FunctionAttributes()
|
{
|
key = "mode",
|
value = new List<string> { "day", "night", "away", "normal", "timer" },
|
max = 4,
|
min = 0,
|
};
|
}
|
_trait_mode.curValue = _trait_mode.value.Count > 0 ? _trait_mode.value[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
|
{
|
try
|
{
|
byte index = 0;
|
switch (trait_mode.curValue.ToString())
|
{
|
case "day":
|
index = 2;
|
break;
|
case "night":
|
index = 3;
|
break;
|
case "away":
|
index = 4;
|
break;
|
case "normal":
|
index = 1;
|
break;
|
case "timer":
|
index = 5;
|
break;
|
default:
|
index = 0;
|
break;
|
}
|
return index;
|
}
|
catch (Exception ex)
|
{
|
MainPage.Log($"get curModeIndex error : {ex.Message}");
|
return 0;
|
}
|
}
|
set
|
{
|
switch (value)
|
{
|
case 5:
|
trait_mode.curValue = "timer";
|
break;
|
case 1:
|
trait_mode.curValue = "normal";
|
break;
|
case 2:
|
trait_mode.curValue = "day";
|
break;
|
case 3:
|
trait_mode.curValue = "night";
|
break;
|
case 4:
|
trait_mode.curValue = "away";
|
break;
|
default:
|
trait_mode.curValue = "cool";
|
break;
|
|
}
|
}
|
}
|
|
/// <summary>
|
/// 时间标记
|
/// 0:白天;1:夜晚
|
/// </summary>
|
public byte timeFlag = 0;
|
|
/// <summary>
|
/// 室内温度
|
/// </summary>
|
[Newtonsoft.Json.JsonIgnore]
|
public int indoorTemp = 20;
|
|
|
FunctionAttributes _trait_temp;
|
/// <summary>
|
/// 当前温度
|
/// </summary>/// <summary>
|
/// 当前空调温度
|
/// </summary>
|
[Newtonsoft.Json.JsonIgnore]
|
public FunctionAttributes trait_temp
|
{
|
get
|
{
|
if (_trait_temp == null)
|
{
|
_trait_temp = function.Find((obj) => obj.key == "set_temperature");
|
//找不到属性需要声明一个,防止报错闪退
|
if (_trait_temp == null)
|
{
|
_trait_temp = new FunctionAttributes()
|
{
|
key = "set_temperature",
|
value = new List<string> { },
|
max = 30,
|
min = 5,
|
};
|
}
|
_trait_temp.curValue = 16;
|
}
|
return _trait_temp;
|
}
|
}
|
/// <summary>
|
/// 当前模式的icon路径
|
/// </summary>
|
[Newtonsoft.Json.JsonIgnore]
|
public string curModeImage
|
{
|
get
|
{
|
try
|
{
|
var imagePath = "FunctionIcon/AC/HeatingIcon.png";
|
switch (trait_mode.curValue)
|
{
|
case "day":
|
imagePath = "FunctionIcon/AC/HeatingIcon.png";
|
break;
|
case "night":
|
imagePath = "FunctionIcon/FloorHeating/NightIcon.png";
|
break;
|
case "away":
|
imagePath = "FunctionIcon/FloorHeating/AwayIcon.png";
|
break;
|
case "timer":
|
imagePath = "FunctionIcon/AC/AutoIcon.png";
|
break;
|
case "normal":
|
imagePath = "FunctionIcon/FloorHeating/OrdinaryIcon.png";
|
break;
|
default:
|
imagePath = "FunctionIcon/AC/HeatingIcon.png";
|
break;
|
}
|
return imagePath;
|
}
|
catch (Exception ex)
|
{
|
MainPage.Log($"ac ge curModeImage error : {ex.Message}");
|
return "FunctionIcon/AC/CoolIcon.png";
|
}
|
}
|
}
|
|
}
|
}
|