From dc0309e64f02227d8e1468b7326c07955f804612 Mon Sep 17 00:00:00 2001
From: chenqiyang <1406175257@qq.com>
Date: 星期三, 22 六月 2022 11:22:18 +0800
Subject: [PATCH] 修改引用路径

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

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs
old mode 100755
new mode 100644
index f0da655..b7ef9d0
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs
@@ -1,241 +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;
-            }
-        }
-
-        /// 闇�瑕佽幏鍙栧浐瀹氬睘鎬х殑瀵硅薄璁惧
-        /// </summary>
-        private HashSet<string> hsGetHardInfoDevice = new HashSet<string>();
-
-        #endregion
-
-        #region 鈻� 涓诲叆鍙e嚱鏁癬________________________
-
-        /// <summary>
-        /// 璇诲彇浠ュ強璁剧疆璁惧鍥哄畾灞炴��
-        /// </summary>
-        /// <param name="device">璁惧鍥炶矾</param>
-        public void SetAllFixedAttributeToDevice(CommonDevice device)
-        {
-            if (device == null)
-            {
-                return;
-            }
-            lock (this.hsGetHardInfoDevice)
-            {
-                //鍏堢Щ闄�
-                this.RemoveDeviceHardInfoThread(device);
-                if (HdlGatewayReceiveLogic.Current.IsEsixt("DeviceGetFixedAttribute") == false)
-                {
-                    //娣诲姞浜嬩欢
-                    HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceGetFixedAttribute",  ReceiveComandDiv.A璁惧灞炴�т笂鎶�, this.SetFixedAttributeByInterfaceResult);
-                }
-                //鍙戦�佸懡浠�
-                this.SeFixedAttributeComand(device);
-            }
-        }
-
-        #endregion
-
-        #region 鈻� 鍙戦�佸懡浠__________________________
-
-        /// <summary>
-        /// 鍙戦�佽幏鍙栧浐瀹氬睘鎬х殑鍛戒护
-        /// </summary>
-        /// <param name="device"></param>
-        private void SeFixedAttributeComand(CommonDevice device)
-        {
-            Newtonsoft.Json.Linq.JObject jObject = null;
-            Newtonsoft.Json.Linq.JArray attriBute = null;
-            //绐楀笜
-            if (device.Type == DeviceType.WindowCoveringDevice)
-            {
-                this.GetCurtainComand(device, ref jObject, ref attriBute);
-            }
-            if (jObject == null)
-            {
-                //涓嶉渶瑕佸彂閫�
-                return;
-            }
-            string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
-            this.hsGetHardInfoDevice.Add(mainkeys);
-            //鍙戦��
-            var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } };
-            jObject.Add("Data", data);
-            device.Gateway?.Send(("GetDeviceStatus"), jObject.ToString());
-        }
-
-        #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
-
-        #region 鈻� 璁剧疆灞炴��(涓诲嚱鏁�)___________________
-
-        /// <summary>
-        /// 璁剧疆璁惧鐨勫浐瀹氬睘鎬�   -1:寮傚父  0:鎺ㄩ�佺殑杩欎釜涓滆タ骞朵笉鏄渶瑕佺殑  1:姝e父
-        /// </summary>
-        /// <param name="report">涓婃姤淇℃伅</param>
-        /// <param name="device">璁惧瀵硅薄</param>
-        /// <returns></returns>
-        private int SetFixedAttribute(CommonDevice.DeviceStatusReportData report, CommonDevice device)
-        {
-            if (report == null)
-            {
-                return -1;
-            }
-            //绐楀笜
-            if (device.Type == DeviceType.WindowCoveringDevice)
-            {
-                return this.SetCurtainAttribute(report, (Rollershade)device);
-            }
-            return 0;
-        }
-
-        #endregion
-
-        #region 鈻� 璁剧疆绐楀笜灞炴�______________________
-
-        /// <summary>
-        /// 璁剧疆绐楀笜灞炴��  -1:寮傚父  0:鎺ㄩ�佺殑杩欎釜涓滆タ骞朵笉鏄渶瑕佺殑  1:姝e父
-        /// </summary>
-        /// <param name="report">涓婃姤淇℃伅</param>
-        /// <param name="device">璁惧瀵硅薄</param>
-        /// <returns></returns>
-        private int SetCurtainAttribute(CommonDevice.DeviceStatusReportData report, Rollershade device)
-        {
-            if (report.CluterID != (int)Cluster_ID.WindowCovering || device == null)
-            {
-                return -1;
-            }
-            //灞炴�ф槸鍚︽敼鍙�
-            bool AttriButeChanged = false;
-            int attriButeId = (int)AttriButeId.WindowCoveringType;
-            foreach (var data in report.AttriBute)
-            {
-                if (data.AttributeId == attriButeId)
-                {
-                    AttriButeChanged = true;
-                    device.WcdType = data.AttriButeData;
-                }
-            }
-            if (AttriButeChanged == true)
-            {
-                //灞炴�у凡缁忔敼鍙�,鍒欎繚瀛�
-                return 1;
-            }
-            return 0;
-        }
-
-        #endregion
-
-        #region 鈻� 鎺ュ彛鎺ㄩ�佸鐞哶______________________
-
-        /// <summary>
-        /// 鏍规嵁鎺ュ彛鎺ㄩ�佺殑淇℃伅锛岃缃澶囩‖浠朵俊鎭�
-        /// </summary>
-        /// <param name="device"></param>
-        private void SetFixedAttributeByInterfaceResult(CommonDevice device)
-        {
-            string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
-            if (this.hsGetHardInfoDevice.Contains(mainKeys) == false)
-            {
-                //鎺ㄩ�佺殑杩欎釜涓滆タ骞朵笉鏄寚瀹氱殑璁惧
-                return;
-            }
-            //璁剧疆璁惧纭欢淇℃伅
-            var localDevice = Common.LocalDevice.Current.GetDevice(mainKeys);
-            if (localDevice == null)
-            {
-                return;
-            }
-            lock (hsGetHardInfoDevice)
-            {
-                //-1:寮傚父  0:鎺ㄩ�佺殑杩欎釜涓滆タ骞朵笉鏄渶瑕佺殑  1:姝e父
-                if (this.SetFixedAttribute(device.DeviceStatusReport, localDevice) != 1)
-                {
-                    return;
-                }
-                //淇濆瓨
-                localDevice.ReSave();
-                //绉婚櫎
-                this.hsGetHardInfoDevice.Remove(mainKeys);
-            }
-        }
-
-        #endregion
-
-        #region 鈻� 绉婚櫎鐩戝惉绾跨▼_______________________
-
-        /// <summary>
-        /// 绉婚櫎鑾峰彇璁惧纭欢淇℃伅鐨勭洃鍚嚎绋�
-        /// </summary>
-        /// <param name="device"></param>
-        public void RemoveDeviceHardInfoThread(CommonDevice device)
-        {
-            lock (hsGetHardInfoDevice)
-            {
-                string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
-                if (this.hsGetHardInfoDevice.Contains(mainKeys) == true)
-                {
-                    this.hsGetHardInfoDevice.Remove(mainKeys);
-                }
-            }
-        }
-
-        #endregion
-    }
-}
+锘縰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