| | |
| | | *属性 描述
|
| | | *switch on/off
|
| | | *mode day, night,away, vacation, timer
|
| | | *temperature up,down,value
|
| | | *temperature value(只读)
|
| | | *lock boolean(Lock锁定控制) |
| | | *set_ point up,down,value |
| | | */ |
| | | public FloorHeating() |
| | | { |
| | |
| | | /// <summary> |
| | | /// 当前温度模式字符 |
| | | /// </summary> |
| | | public string curTempTypeString |
| | | public string tempUnitString |
| | | { |
| | | get |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | 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"); |
| | | //找不到属性需要声明一个,防止报错闪退 |
| | | if (_trait_mode == null) |
| | | { |
| | | _trait_mode = new Trait() |
| | | { |
| | | name = "mode", |
| | | value_key = new List<string> { "day", "night", "away", "vacation", "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 |
| | |
| | | try |
| | | { |
| | | byte index = 0; |
| | | switch (curMode) |
| | | switch (trait_mode.value.ToString()) |
| | | { |
| | | case "day": |
| | | index = 2; |
| | |
| | | case "away": |
| | | index = 4; |
| | | break; |
| | | case "ordinary": |
| | | case "normal": |
| | | index = 1; |
| | | break; |
| | | case "timer": |
| | |
| | | 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 = function.Find((obj) => obj.attri == "mode"); |
| | | //找不到属性需要声明一个,防止报错闪退 |
| | | 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" }; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public int indoorTemp = 20; |
| | | |
| | | |
| | | Trait _trait_temperature; |
| | | /// <summary> |
| | | /// 当前温度 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public int curTemp |
| | | public double curTemp |
| | | { |
| | | get |
| | | { |
| | | switch (curMode) |
| | | try |
| | | { |
| | | case "day": |
| | | if (!modeTemp.ContainsKey("day")) |
| | | if (_trait_temperature == null) |
| | | { |
| | | _trait_temperature = function.Find((obj) => obj.name == "temperature"); |
| | | //找不到属性需要声明一个,防止报错闪退 |
| | | if (_trait_temperature == null) |
| | | { |
| | | 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")) |
| | | _trait_temperature = new Trait() |
| | | { |
| | | modeTemp.Add("day", 20); |
| | | } |
| | | return modeTemp["day"]; |
| | | name = "temperature", |
| | | value_key = new List<string>(), |
| | | max = 32, |
| | | min = 5, |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | if (!modeTemp.ContainsKey("night")) |
| | | { |
| | | modeTemp.Add("night", 20); |
| | | } |
| | | return modeTemp["night"]; |
| | | } |
| | | _trait_temperature.value = 5; |
| | | } |
| | | return 5; |
| | | } |
| | | return 20; |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"ac get temp error : {ex.Message}"); |
| | | return 5; |
| | | } |
| | | } |
| | | set |
| | | { |
| | | switch (curMode) |
| | | if (_trait_temperature == null) |
| | | { |
| | | case "day": |
| | | if (!modeTemp.ContainsKey("day")) |
| | | _trait_temperature = function.Find((obj) => obj.name == "temperature"); |
| | | //找不到属性需要声明一个,防止报错闪退 |
| | | if (_trait_temperature == null) |
| | | { |
| | | _trait_temperature = new Trait() |
| | | { |
| | | 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; |
| | | name = "temperature", |
| | | value_key = new List<string>(), |
| | | max = 4, |
| | | min = 0, |
| | | }; |
| | | } |
| | | _trait_temperature.value = _trait_temperature.value_key[_trait_temperature.min]; |
| | | } |
| | | _trait_temperature.value = value; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 当前模式的icon路径 |
| | |
| | | try |
| | | { |
| | | var imagePath = "FunctionIcon/AC/HeatingIcon.png"; |
| | | switch (curMode) |
| | | switch (trait_mode.value) |
| | | { |
| | | case "day": |
| | | imagePath = "FunctionIcon/AC/HeatingIcon.png"; |
| | |
| | | case "timer": |
| | | imagePath = "FunctionIcon/AC/AutoIcon.png"; |
| | | break; |
| | | case "ordinary": |
| | | case "normal": |
| | | imagePath = "FunctionIcon/FloorHeating/OrdinaryIcon.png"; |
| | | break; |
| | | default: |