From 37c33341f75841dc39c535eb62a3603f596516a1 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 27 二月 2020 17:11:53 +0800
Subject: [PATCH] 20200227

---
 HDL_ON/Entity/Function/Light/Light.cs |   35 ++++++++++++++++++++++++++++++-----
 1 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/HDL_ON/Entity/Function/Light/Light.cs b/HDL_ON/Entity/Function/Light/Light.cs
index 5455156..2380265 100644
--- a/HDL_ON/Entity/Function/Light/Light.cs
+++ b/HDL_ON/Entity/Function/Light/Light.cs
@@ -8,7 +8,23 @@
     {
         public Light()
         {
-            bus_DeviceType = "Relay";
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        protected override string GetFunctionType()
+        {
+            string type = "Relay";
+            if (PropertyArray.Contains("brightness"))
+            {
+                type = "Dimmer";
+                if (PropertyArray.Contains("color"))
+                {
+                    type = "RGB";
+                }
+            }
+            return type;
         }
 
         /// <summary>
@@ -18,7 +34,6 @@
         /// </summary>
         public int state = 0;
 
-        public List<string> PropertyArray = new List<string>();
 
         /// <summary>
         /// 鎷兼帴銆佽幏鍙朅鍗忚鎿嶄綔鏁版嵁
@@ -30,13 +45,23 @@
             {
 
                 sendJob = new JObject { { "Namespace", a_Protocol_Namespace }, { "Command", command }, { "Type", "device" } };
-                var data = new JObject { { "Switch", state }, { "sid", sid } };
+                JObject data = null;
+                switch (functionType)
+                {
+                    case "Relay"://缁х數鍣ㄦ帶鍒�
+                        data = new JObject { { "switch", state }, { "sid", sid } };
+                        break;
+                    case "Dimmer":
+                        data = new JObject { { "Switch", state }, { "brightness", dicPropert["brightness"] }, { "sid", sid } };
+                        break;
+                }
                 sendJob.Add("objects", data);
-                return sendJob;
             }
             else if(command == "read")
             {
-
+                sendJob = new JObject { { "Namespace", a_Protocol_Namespace }, { "Command", command }, { "Type", "device" } };
+                var data = new JObject {{ "sid", sid } };
+                sendJob.Add("objects", data);
             }
             return sendJob;
         }

--
Gitblit v1.8.0