From f14dcfd967404e197e7ec995ca8d6f2b090d3b7d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 11 九月 2020 09:16:59 +0800
Subject: [PATCH] 优化多功能面板:绑定温湿度传感器目标,和设备列表回路显示。优化数据矫正功能温湿度度不设置的情况。优化门锁时间设置最后一天和最后最后一个月的时间显示等 细节

---
 ZigbeeApp/Shared/Phone/ZigBee/Device/ColorTemperatureLight.cs |  123 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 123 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ColorTemperatureLight.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ColorTemperatureLight.cs
new file mode 100755
index 0000000..6dcd028
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ColorTemperatureLight.cs
@@ -0,0 +1,123 @@
+锘縰sing Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ZigBee.Device
+{
+    /// <summary>
+    /// 鑹叉俯鐏�
+    /// </summary>
+    public class ColorTemperatureLight : LightBase
+    {
+        public ColorTemperatureLight()
+        {
+            this.Type = DeviceType.ColorTemperatureLight;
+        }
+
+        /// <summary>
+        ///浜害锛屾暣褰紝鍙栧�艰寖鍥达細0-254琛ㄧず0%-100% 
+        /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
+        public int Level = 0;
+
+        /// <summary>
+        ///鑹叉俯锛屽彇鍊艰寖鍥达細3000~6000(杩欓噷璁板綍鐨勫�肩殑鍗曚綅鏄� 鍗�)
+        /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
+        public int ColorTemperature = 0;
+
+        /// <summary>
+        ///铚傞福鍣ㄦ槸鍚﹀湪鍝嶇潃(true:鍝嶇潃 false:涓嶅搷)
+        /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
+        public bool IsBuzzerRing = false;
+
+        /// <summary>
+        /// 璇诲彇浜害
+        /// </summary>
+        public void ReadLevel()
+        {
+            ReadAttri(Device.Cluster_ID.LevelControl, AttriButeId.LevelControl);
+        }
+
+        /// <summary>
+        /// 璇诲彇鑹叉俯
+        /// </summary>
+        public void ReadColorTemperature()
+        {
+            ReadAttri(Device.Cluster_ID.ColorControl, AttriButeId.LevelControl);
+        }
+
+        /// <summary>
+        /// 璇诲彇铚傞福鍣ㄧ姸鎬�(灏忓鐏笓鐢�)
+        /// </summary>
+        public void ReadBuzzerStatu()
+        {
+            ReadAttri((Cluster_ID)1282, 0);
+        }
+
+        ///<summary >
+        ///璁剧疆璁惧浜害锛圠evel锛�
+        ///<para>value:浜害鍊煎彇鍊艰寖鍥达細0-254</para>
+        /// </summary>
+        public void SetLevel(int value)
+        {
+            var jObject = new JObject {
+                { "DeviceAddr", DeviceAddr},
+                { "Epoint", DeviceEpoint},
+                    { "Cluster_ID", 8 },
+                    { "Command", 4},
+                    { "SendMode", 2 }
+                };
+            var data = new JObject {
+                    { "Level", value },
+                    { "TransitionTime", 0 }
+                };
+            jObject.Add("Data", data);
+            Gateway?.Send("DeviceControl", jObject.ToString());
+        }
+
+        ///<summary >
+        ///璁剧疆璁惧鑹叉俯
+        ///<para>value:鑹叉俯鍊煎彇鍊艰寖鍥达細3400-6000</para>
+        /// </summary>
+        public void SetColorTemperature(int value)
+        {
+            var jObject = new JObject {
+                { "DeviceAddr", DeviceAddr},
+                { "Epoint", DeviceEpoint},
+                    { "Cluster_ID", 768 },
+                    { "Command", 10},
+                    { "SendMode", 2 }
+                };
+            var data = new JObject {
+                    { "ColorTemperature", value },
+                    { "TransitionTime", 0 }
+                };
+            jObject.Add("Data", data);
+            Gateway?.Send("DeviceControl", jObject.ToString());
+        }
+
+        /// <summary>
+        /// 鍙戦�佹墦寮�鑾峰彇鍏抽棴铚傞福鍣ㄧ殑鍛戒护(鐩墠鍏堣繖鏍峰惂,灏忓鐏殑铚傞福鍣�)
+        /// </summary>
+        /// <param name="isOpen"></param>
+        public void SendBuzzerSwitchControl(bool isOpen)
+        {
+            var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 1282 }, { "Command", 0 } };
+            var data = new JObject {
+                { "WarningMode", isOpen==true?1:0 },//0:鍏抽棴鎶ヨ 1:鎵撳紑鎶ヨ
+                { "Strobe", 0 },//鏄惁鍚姩鎶ヨ鐏� 0:涓嶅惎鍔� 1:鍚姩
+                { "SirenLevel", 0 },//鎶ヨ闊抽噺 0锛歀ow  1锛歁edium  2锛歨igh  3: very high
+                { "WarningDuration", isOpen==true?10:0 }, //鎶ヨ鏃堕暱 0 -65535 鍗曚綅锛氱
+                { "StrobeDutyCycle", 50 }, //鎶ヨ绛夐棯鐑佸崰绌烘瘮 0-100
+                { "StrobeLevel", 1 } //鎶ヨ鐏寒搴� 0锛歀ow  1锛歁edium  2锛歨igh  3: very high
+            };
+            jObject.Add("Data", data);
+
+            //涓婚鍙互涔卞啓鐨�
+            Gateway.Send("SendSwitchCommand", jObject.ToString());
+        }
+    }
+}

--
Gitblit v1.8.0