From 4f0ab0ad21ce450b7856d50f98322a7899361386 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 22 九月 2020 10:30:01 +0800
Subject: [PATCH] 不要下载这个备份
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs | 169 +++++---------------------------------------------------
1 files changed, 16 insertions(+), 153 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs
index fdb4e4a..b5ff35b 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceFixedAttributeLogic.cs
@@ -31,68 +31,46 @@
}
}
- /// 闇�瑕佽幏鍙栧浐瀹氬睘鎬х殑瀵硅薄璁惧
- /// </summary>
- private HashSet<string> hsGetHardInfoDevice = new HashSet<string>();
-
#endregion
#region 鈻� 涓诲叆鍙e嚱鏁癬________________________
/// <summary>
- /// 璇诲彇浠ュ強璁剧疆璁惧鍥哄畾灞炴��
+ /// 璇诲彇浠ュ強璁剧疆璁惧鍥哄畾灞炴��(false:涓嶉渶瑕佸彂閫佸懡浠�)
/// </summary>
- /// <param name="device">璁惧鍥炶矾</param>
- public void SetAllFixedAttributeToDevice(CommonDevice device)
+ /// <param name="i_device">璁惧鍥炶矾</param>
+ public bool SetAllFixedAttributeToDevice(CommonDevice i_device)
{
- if (device == null)
+ if (i_device == null)
{
- return;
+ return false;
}
- lock (this.hsGetHardInfoDevice)
+ var localDevice = Common.LocalDevice.Current.GetDevice(i_device.DeviceAddr, i_device.DeviceEpoint);
+ if (localDevice == null)
{
- //鍏堢Щ闄�
- this.RemoveDeviceHardInfoThread(device);
-
- string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
- this.hsGetHardInfoDevice.Add(mainkeys);
-
- if (HdlGatewayReceiveLogic.Current.IsEsixt("DeviceGetFixedAttribute") == false)
- {
- //娣诲姞浜嬩欢
- HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceGetFixedAttribute", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, this.SetFixedAttributeByInterfaceResult);
- }
- //鍙戦�佸懡浠�
- this.SeFixedAttributeComand(device);
+ //ota涔熶細璺戣繘鏉�
+ return false;
}
- }
- #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)
+ if (localDevice.Type == DeviceType.WindowCoveringDevice
+ && ((Rollershade)localDevice).WcdType == -1)
{
- this.GetCurtainComand(device, ref jObject, ref attriBute);
+ this.GetCurtainComand(localDevice, ref jObject, ref attriBute);
}
if (jObject == null)
{
//涓嶉渶瑕佸彂閫�
- return;
+ return false;
}
//鍙戦��
var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } };
jObject.Add("Data", data);
- device.Gateway?.Send(("GetDeviceStatus"), jObject.ToString());
+ localDevice.Gateway?.Send(("GetDeviceStatus"), jObject.ToString());
+
+ return true;
}
#endregion
@@ -121,121 +99,6 @@
{ "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
--
Gitblit v1.8.0