From ad94907bfe5389114dcb841b339886c6a8ef6851 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 02 四月 2020 17:09:23 +0800
Subject: [PATCH] 2020-04-2-02-3
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs | 93 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 90 insertions(+), 3 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
index 34330b4..90a72cc 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
@@ -205,6 +205,87 @@
#endregion
+ #region 鈻� 鎺ヨ繎鎰熷簲___________________________
+ /// <summary>
+ /// 鑾峰彇鎺ヨ繎鎰熷簲閰嶇疆锛坲i鍙帴杩戞劅搴�,浣跨敤杩斿洖鍊肩殑panelProximitySensorInfo锛�
+ /// </summary>
+ /// <param name="device">璁惧瀵硅薄</param>
+ /// <returns></returns>
+ public async Task<Panel.PanelProximitySensorInfo> GetDeviceProximitySensorsSettion(CommonDevice device)
+ {
+ //鍊熺敤瀹冪殑鍑芥暟
+ var panel = new Panel();
+ panel.DeviceAddr = device.DeviceAddr;
+ panel.DeviceEpoint = device.DeviceEpoint;
+ panel.CurrentGateWayId = device.CurrentGateWayId;
+
+ var result = await panel.GetProximitySensorAsync();
+ panel = null;
+ //鍏遍�氶敊璇娴�
+ string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
+ if (error != null)
+ {
+ this.ShowErrorMsg(error);
+ return null;
+ }
+ if (result == null || result.panelProximitySensorInfo == null || string.IsNullOrEmpty(result.errorMessageBase) == false)
+ {
+ //鑾峰彇鎺ヨ繎鎰熷簲淇℃伅澶辫触
+ string msg = Language.StringByID(R.MyInternationalizationString.GetPanelProximityFail);
+ this.ShowErrorMsg(msg);
+ return null;
+ }
+ return result.panelProximitySensorInfo;
+ }
+
+
+ /// <summary>
+ /// 閰嶇疆鎺ヨ繎浼犳劅
+ /// </summary>
+ /// <param name="device">璁惧瀵硅薄</param>
+ /// <para>sensorEnable:浼犳劅鍣ㄤ娇鑳�</para>
+ /// <returns></returns>
+ public async Task<bool> SetProximitySensorStatus(CommonDevice device, bool sensorEnable)
+ {
+ //鍊熺敤瀹冪殑鍑芥暟
+ var panel = new Panel();
+ panel.DeviceAddr = device.DeviceAddr;
+ panel.DeviceEpoint = device.DeviceEpoint;
+ panel.CurrentGateWayId = device.CurrentGateWayId;
+
+ var result = await panel.SetProximitySensor(sensorEnable);
+ panel = null;
+
+ //鍏遍�氶敊璇娴�
+ string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
+ if (error != null)
+ {
+ this.ShowErrorMsg(error);
+ return false;
+ }
+
+ if (result == null || result.responseData == null)
+ {
+ //鎺ヨ繎浼犳劅閰嶇疆澶辫触
+ string msg = Language.StringByID(R.MyInternationalizationString.SetPannelProximityFail);
+ //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+ msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+ this.ShowTipMsg(msg);
+ return false;
+ }
+
+ // 澶囦唤璁惧
+ var backData = new Newtonsoft.Json.Linq.JObject
+ {
+ { "sensorEnable",sensorEnable }
+ };
+ //澶囦唤璁惧
+ await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.A闈㈡澘鎺ヨ繎鎰熷簲鍔熻兘, backData);
+ return true;
+ }
+ #endregion
+
#region 鈻� 鑺傝兘妯″紡___________________________
/// <summary>
/// 鑾峰彇璁惧鑺傝兘妯″紡鐨勯厤缃姸鎬�(ui鍙妭鑳芥ā寮�)
@@ -479,12 +560,12 @@
#region 鈻� 淇敼骞叉帴鐐圭鏈夊睘鎬________________
/// <summary>
- /// 淇敼骞叉帴鐐圭鏈夊睘鎬�
+ /// 淇敼骞叉帴鐐圭涓夌骇鍒殑绉佹湁灞炴��
/// </summary>
/// <param name="panel">骞叉帴鐐瑰璞�</param>
/// <param name="i_value">骞叉帴鐐圭殑绗笁绾у埆灞炴�х殑鍊�,鍏蜂綋璇峰弬鐓х涓夌骇鍒睘鎬�</param>
/// <returns></returns>
- public async Task<bool> EditorDryContactFunction(Panel panel, int i_value)
+ public async Task<bool> EditorDryContactThirdFunction(Panel panel, int i_value)
{
var result = await panel.ConfigureHdlKeyValueAsync((Panel.KeyMode)i_value);
//鍏遍�氶敊璇娴�
@@ -537,7 +618,7 @@
return false;
}
//澶囦唤璁惧
- await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(panel, GatewayBackupEnum.A骞叉帴鐐圭鏈夊睘鎬�, i_value);
+ await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(panel, GatewayBackupEnum.A骞叉帴鐐圭涓夌骇鍒鏈夊睘鎬�, i_value);
return true;
}
@@ -707,7 +788,13 @@
errorMsg = UserCenterLogic.CombineGatewayTimeOutMsg(errorMsg, null, "鍥炲瓒呮椂", false);
}
this.ShowTipMsg(errorMsg);
+ return false;
}
+ //澶囦唤璁惧
+ HdlThreadLogic.Current.RunThread(async () =>
+ {
+ await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.A绠�绾﹂潰鏉块渿鍔ㄥ姛鑳�, datainfo);
+ }, ShowErrorMode.NO);
return success;
}
--
Gitblit v1.8.0