From 72e1b4e4626315ebd4b879a68c94e7738fd0473e Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 28 十月 2019 11:00:28 +0800
Subject: [PATCH] 2019-10-28-1
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs | 101 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 98 insertions(+), 3 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs
index d59f95d..c2f7d13 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceBindLogic.cs
@@ -76,7 +76,7 @@
/// </summary>
/// <param name="mainDevice">璁惧瀵硅薄</param>
/// <param name="listDevice">瑕佺粦瀹氱殑鐩爣璁惧</param>
- /// <param name="BindCluster">瑕佺粦瀹氱殑鐩爣璁惧</param>
+ /// <param name="BindCluster">BindCluster</param>
/// <returns></returns>
public async Task<List<CommonDevice>> BindDeviceTarget(CommonDevice mainDevice, List<CommonDevice> listDevice, int BindCluster = 6)
{
@@ -191,7 +191,7 @@
/// </summary>
/// <param name="mainDevice">璁惧瀵硅薄</param>
/// <param name="deleteDevice">瑕佸垹闄ょ殑缁戝畾鐩爣璁惧</param>
- /// <param name="BindCluster">瑕佺粦瀹氱殑鐩爣璁惧</param>
+ /// <param name="BindCluster">BindCluster</param>
/// <returns></returns>
public async Task<bool> DeleteDeviceTarget(CommonDevice mainDevice, CommonDevice deleteDevice, int BindCluster = 6)
{
@@ -201,7 +201,7 @@
deleteData.Epoint = mainDevice.DeviceEpoint;
var info = new IASZone.RemoveBindListObj();
- info.BindCluster = 6;
+ info.BindCluster = BindCluster;
info.BindMacAddr = deleteDevice.DeviceAddr;
info.BindEpoint = deleteDevice.DeviceEpoint;
info.BindType = 0;
@@ -271,6 +271,101 @@
return false;
}
+ /// <summary>
+ /// 鍒犻櫎璁惧缁戝畾鐨勭洰鏍�
+ /// </summary>
+ /// <param name="mainDevice">璁惧瀵硅薄</param>
+ /// <param name="listDeleteDevice">瑕佸垹闄ょ殑缁戝畾鐩爣璁惧</param>
+ /// <param name="BindCluster">BindCluster</param>
+ /// <returns>杩斿洖鐨勬槸鎴愬姛鍒犻櫎鐨勮澶�</returns>
+ public async Task<List<CommonDevice>> DeleteDeviceTarget(CommonDevice mainDevice, List<CommonDevice> listDeleteDevice, int BindCluster = 6)
+ {
+ //缁勮鏁版嵁
+ var deleteData = new IASZone.DelDeviceBindData();
+ deleteData.DeviceAddr = mainDevice.DeviceAddr;
+ deleteData.Epoint = mainDevice.DeviceEpoint;
+
+ var dicDevice = new Dictionary<string, CommonDevice>();
+ foreach (var device in listDeleteDevice)
+ {
+ var info = new IASZone.RemoveBindListObj();
+ info.BindCluster = BindCluster;
+ info.BindMacAddr = device.DeviceAddr;
+ info.BindEpoint = device.DeviceEpoint;
+ info.BindType = 0;
+
+ deleteData.RemoveBindList.Add(info);
+ //杩斿洖鎴愬姛璁惧鐨勬椂鍊欎娇鐢�
+ string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
+ dicDevice[mainkeys] = device;
+ }
+ var listSuccess = new List<CommonDevice>();
+
+ var result = (BindObj.DelDeviceBindResponseAllData)await this.LoadDeviceMethodByNameAsync(mainDevice, "DelDeviceBindAsync", deleteData);
+ if (result == null || result.delDeviceBindResponseData == null)
+ {
+ //鍒犻櫎缁戝畾鐩爣澶辫触
+ string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
+ //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+ msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+ this.ShowErrorMsg(msg);
+ return listSuccess;
+ }
+
+ foreach (var data in result.delDeviceBindResponseData.RemoveBindList)
+ {
+ string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(data.BindMacAddr, data.BindEpoint);
+ //0:鎴愬姛 1:璁惧涓嶅湪缁戝畾鍒楄〃涓� 锛屼篃鍙互浠h〃鎴愬姛
+ if (data.Result == 0 || data.Result == 1)
+ {
+ listSuccess.Add(dicDevice[mainkeys]);
+ }
+ //3:澶辫触锛屽湪绛夊緟鑺傜偣璁惧纭鏄惁瑙i櫎缁戝畾鎴愬姛
+ else if (data.Result == 3)
+ {
+ //璁惧鍚嶇О 鍏朵粬缁戝畾鐩爣姝e湪鍒犻櫎涓紝璇风◢鍚庡啀璇�
+ string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n";
+ msg += Language.StringByID(R.MyInternationalizationString.uOtherBindTargetsIsDelettingPleaseWait);
+ this.ShowErrorMsg(msg);
+ }
+ //4锛氭湭鐭ワ紝鐢辫妭鐐硅澶囧弽棣堝彂閫佲�淏ind/BindResult鈥濅富棰樻秷鎭‘瀹氭槸鍚︽垚鍔�
+ else if (data.Result == 4)
+ {
+ if (result.removeBindResultResponseData == null)
+ {
+ //璁惧鍚嶇О 鍒犻櫎缁戝畾鐩爣澶辫触
+ string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n";
+ msg += Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
+ this.ShowErrorMsg(msg);
+ }
+ else
+ {
+ //鎴愬姛
+ if (result.removeBindResultResponseData.Result == 0)
+ {
+ listSuccess.Add(dicDevice[mainkeys]);
+ }
+ //136锛氭帶鍒惰澶囨湰鍦扮粦瀹氬垪琛ㄤ腑鏃犳缁戝畾
+ else if (result.removeBindResultResponseData.Result == 136)
+ {
+ //杩欎釜鍙互褰撳仛鎴愬姛
+ listSuccess.Add(dicDevice[mainkeys]);
+ }
+ else
+ {
+ //璁惧鍚嶇О 鍒犻櫎缁戝畾鐩爣澶辫触
+ string msg = Common.LocalDevice.Current.GetDeviceEpointName(dicDevice[mainkeys]) + "\r\n";
+ msg += Language.StringByID(R.MyInternationalizationString.uDeleteBindTargetsFail);
+ this.ShowErrorMsg(msg);
+ }
+ }
+ }
+ }
+ return listSuccess;
+ }
+
+
#endregion
#region 鈻� 涓�鑸柟娉昣__________________________
--
Gitblit v1.8.0