From 91c2194fce3958afed333119c3aeed3c49ef6bcf Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 03 三月 2021 15:20:44 +0800
Subject: [PATCH] 2021-3-3-2

---
 Crabtree/SmartHome/HDL/Operation/Device/FoolHeat.cs |   81 ++++++++++++++++++++++++++--------------
 1 files changed, 52 insertions(+), 29 deletions(-)

diff --git a/Crabtree/SmartHome/HDL/Operation/Device/FoolHeat.cs b/Crabtree/SmartHome/HDL/Operation/Device/FoolHeat.cs
index 1aa6b00..c16d789 100644
--- a/Crabtree/SmartHome/HDL/Operation/Device/FoolHeat.cs
+++ b/Crabtree/SmartHome/HDL/Operation/Device/FoolHeat.cs
@@ -6,20 +6,20 @@
 
 namespace Shared
 {
-[System.Serializable]
-	public class FoolHeat:Common
-	{
-		public FoolHeat ()
-		{
-			this.Type = DeviceType.FoolHeat;;
+    [System.Serializable]
+    public class FoolHeat : Common
+    {
+        public FoolHeat ()
+        {
+            this.Type = DeviceType.FoolHeat; ;
             DeviceTextID = SimpleControl.R.MyInternationalizationString.FoolHeat;
-		}
+        }
 
-		/// <summary>
-		/// 宸ヤ綔妯″紡
+        /// <summary>
+        /// 宸ヤ綔妯″紡
         /// 0鍒剁儹锛�1鍒跺喎锛�2锛�3
-		/// </summary>
-		public byte WorkingMode = 0;
+        /// </summary>
+        public byte WorkingMode = 0;
         /// <summary>
         /// 娓╁害妯″紡
         /// </summary>
@@ -31,13 +31,13 @@
         /// </summary>
 		public byte TemperatureType;
 
-		public byte NormalTemperature;
+        public byte NormalTemperature;
 
-		public byte DayTemperature;
+        public byte DayTemperature;
 
-		public byte NightTemperature;
+        public byte NightTemperature;
 
-		public byte AwayTemperature;
+        public byte AwayTemperature;
 
         public byte Timer;//0 = Day, 1 = Night
 
@@ -55,14 +55,14 @@
         /// <summary>
         /// 宸ヤ綔娓╁害
         /// </summary>
-        public byte WorkingTemperature =5;
+        public byte WorkingTemperature = 5;
         public byte PIDSpeed;
         public byte IndoorTemperature;
         public byte FloorTemperature;
 
-        public byte[] FH_Bytes;
+        public byte [] FH_Bytes;
 
-        public FoolHeat Serverx_FH_CMD (CommandType commandType, byte[] updataBytes = null)
+        public FoolHeat Serverx_FH_CMD (CommandType commandType, byte [] updataBytes = null)
         {
             if (updataBytes != null)
                 FH_Bytes = updataBytes;
@@ -101,7 +101,7 @@
             } else if (commandType == CommandType.TemperatrueMode) {
                 FH_Bytes = Control.ControlBytesSendHasReturn (Command.SetFoolHeat, SubnetID, DeviceID, new byte [] { LoopID, FH_Bytes [1], FH_Bytes [2], TemperatureType, FH_Bytes [4], FH_Bytes [5], FH_Bytes [6], FH_Bytes [7], 0, 0 });
                 return this;
-            } 
+            }
 
             this.WorkingMode = FH_Bytes [1] > 10 ? (byte)1 : (byte)0;
             this.Status = (byte)(FH_Bytes [1] % 2);
@@ -144,11 +144,11 @@
             return this;
         }
 
-        public  enum CommandType
+        public enum CommandType
         {
             Read = 0,
             Switch = 1,
-            Temperatrue =3,
+            Temperatrue = 3,
             TemperatrueMode = 7,
             WorkMode = 9,
             Null = 999,
@@ -161,14 +161,37 @@
         /// <returns></returns>
         public string SetModeAttribute {
             get {
-                return TemperatureType switch {
-                    1 => "normal",
-                    2 => "day",
-                    3 => "night",
-                    4 => "away",
-                    5 => "timer",
-                    _ => "normal",
-                };
+                //return TemperatureType switch {
+                //    1 => "normal",
+                //    2 => "day",
+                //    3 => "night",
+                //    4 => "away",
+                //    5 => "timer",
+                //    _ => "normal",
+                //};
+
+                string mode;
+                switch (TemperatureType) {
+                case 1:
+                    mode = "normal";
+                    break;
+                case 2:
+                    mode = "day";
+                    break;
+                case 3:
+                    mode = "night";
+                    break;
+                case 4:
+                    mode = "away";
+                    break;
+                case 5:
+                    mode = "timer";
+                    break;
+                default:
+                    mode = "normal";
+                    break;
+                }
+                return mode;
             }
         }
 

--
Gitblit v1.8.0