From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs |  106 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 106 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs
new file mode 100644
index 0000000..b7ef9d0
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs
@@ -0,0 +1,106 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.UserCenter
+{
+    /// <summary>
+    /// 璁惧鍥哄畾淇℃伅鐨勯�昏緫
+    /// </summary>
+    public class HdlDeviceFixedAttributeLogic
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 璁惧鍥哄畾淇℃伅鐨勯�昏緫
+        /// </summary>
+        private static HdlDeviceFixedAttributeLogic m_Current = null;
+        /// <summary>
+        /// 璁惧鍥哄畾淇℃伅鐨勯�昏緫
+        /// </summary>
+        public static HdlDeviceFixedAttributeLogic Current
+        {
+            get
+            {
+                if (m_Current == null)
+                {
+                    m_Current = new HdlDeviceFixedAttributeLogic();
+                }
+                return m_Current;
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 涓诲叆鍙e嚱鏁癬________________________
+
+        /// <summary>
+        /// 璇诲彇浠ュ強璁剧疆璁惧鍥哄畾灞炴��(false:涓嶉渶瑕佸彂閫佸懡浠�)
+        /// </summary>
+        /// <param name="i_device">璁惧鍥炶矾</param>
+        public bool SetAllFixedAttributeToDevice(CommonDevice i_device)
+        {
+            if (i_device == null)
+            {
+                return false;
+            }
+            var localDevice = Common.LocalDevice.Current.GetDevice(i_device.DeviceAddr, i_device.DeviceEpoint);
+            if (localDevice == null)
+            {
+                //ota涔熶細璺戣繘鏉�
+                return false;
+            }
+
+            Newtonsoft.Json.Linq.JObject jObject = null;
+            Newtonsoft.Json.Linq.JArray attriBute = null;
+            //绐楀笜
+            if (localDevice.Type == DeviceType.WindowCoveringDevice
+                && ((Rollershade)localDevice).WcdType == -1)
+            {
+                this.GetCurtainComand(localDevice, ref jObject, ref attriBute);
+            }
+            if (jObject == null)
+            {
+                //涓嶉渶瑕佸彂閫�
+                return false;
+            }
+            //鍙戦��
+            var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } };
+            jObject.Add("Data", data);
+            localDevice.Gateway?.Send(("GetDeviceStatus"), jObject.ToString());
+
+            return true;
+        }
+
+        #endregion
+
+        #region 鈻� 鑾峰彇绐楀笜鍛戒护_______________________
+
+        /// <summary>
+        /// 鑾峰彇绐楀笜鍛戒护
+        /// </summary>
+        /// <param name="device">璁惧瀵硅薄</param>
+        /// <param name="jObject">鏍囬鏁版嵁</param>
+        /// <param name="attriBute">灞炴�ф暟鎹�</param>
+        private void GetCurtainComand(CommonDevice device, ref Newtonsoft.Json.Linq.JObject jObject, ref Newtonsoft.Json.Linq.JArray attriBute)
+        {
+            jObject = new Newtonsoft.Json.Linq.JObject
+            {
+               { "DeviceAddr",device.DeviceAddr },
+               { "Epoint", device.DeviceEpoint },
+               { "Cluster_ID", (int)Cluster_ID.WindowCovering },
+               { "Command", 108 }
+            };
+            attriBute = new Newtonsoft.Json.Linq.JArray
+            {
+               new Newtonsoft.Json.Linq.JObject
+               {
+                  { "AttriButeId", (int)AttriButeId.WindowCoveringType }
+               }
+            };
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0