From 407fae6f07a2a982a2a814c2f145c40733c966cb Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 12 一月 2022 15:29:34 +0800
Subject: [PATCH] 2022-01-12 1.更新

---
 Crabtree/SmartHome/HDL/Operation/Device/FoolHeat.cs |   86 ++++++++++++++++++++++++++++++++-----------
 1 files changed, 64 insertions(+), 22 deletions(-)

diff --git a/Crabtree/SmartHome/HDL/Operation/Device/FoolHeat.cs b/Crabtree/SmartHome/HDL/Operation/Device/FoolHeat.cs
old mode 100755
new mode 100644
index f37c812..c16d789
--- 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,14 +144,56 @@
             return this;
         }
 
-        public  enum CommandType
+        public enum CommandType
         {
             Read = 0,
             Switch = 1,
-            Temperatrue =3,
+            Temperatrue = 3,
             TemperatrueMode = 7,
             WorkMode = 9,
             Null = 999,
         }
-	}
+
+
+        /// <summary>
+        /// 妯″紡A鍗忚灞炴��
+        /// </summary>
+        /// <returns></returns>
+        public string SetModeAttribute {
+            get {
+                //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;
+            }
+        }
+
+    }
 }
\ No newline at end of file

--
Gitblit v1.8.0