From 136b9e2fc48249a5ff89874f1080ba94130e7a9e Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 19 五月 2020 11:12:29 +0800
Subject: [PATCH] Merge branch 'dev-tzy' into dev-2020xm
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs | 140 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 140 insertions(+), 0 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
index 8c56b72..7975fd9 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
@@ -82,6 +82,34 @@
}
/// <summary>
+ /// 鑾峰彇闈㈡澘棰滆壊鐨勪俊鎭�(鍑洪敊浼氳繑鍥瀗ull)
+ /// </summary>
+ /// <param name="panel">鎸夐敭闈㈡澘鐨勬煇涓�涓洖璺�</param>
+ /// <returns></returns>
+ public async Task<Panel.KeyColorData> GetPanelColorInfo(Panel panel)
+ {
+ panel.DeviceEpoint = 1;
+ Panel.KeyNum keyNum = (Panel.KeyNum)panel.DeviceEpoint;
+ var result = await panel.GetPanelColorInfoAsync(keyNum);
+ //鍏遍�氶敊璇娴�
+ string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
+ if (error != null)
+ {
+ this.ShowErrorMsg(error);
+ return null;
+ }
+
+ if (result == null || result.keyColorData == null)
+ {
+ //鑾峰彇鎸夐敭闈㈡澘棰滆壊璋冭妭淇℃伅澶辫触
+ string msg = Language.StringByID(R.MyInternationalizationString.uGetPanelColorRegulationInfoFail);
+ this.ShowErrorMsg(msg);
+ return null;
+ }
+ return result.keyColorData;
+ }
+
+ /// <summary>
/// 璁剧疆鎸夐敭闈㈡澘鎸囧畾绔偣鐨勩�愭寚绀虹伅寮�鍏抽鑹层�戠殑淇℃伅
/// </summary>
/// <param name="panel">鎸夐敭闈㈡澘鐨勬煇涓�涓洖璺�</param>
@@ -93,6 +121,37 @@
Type type = keyNum.GetType();
type.InvokeMember("Key" + panel.DeviceEpoint, System.Reflection.BindingFlags.SetField, null, keyNum, new object[] { true });
+ var result = await panel.SetPanelColorInfoAsync(colorData, keyNum);
+ if (result == null || result.responseData == null)
+ {
+ //璁剧疆鎸夐敭闈㈡澘鎸囩ず鐏鑹插け璐�
+ string msg = Language.StringByID(R.MyInternationalizationString.uSetPanelPilolightSettionFail);
+ this.ShowErrorMsg(msg);
+ return false;
+ }
+ if (result.responseData.status != 0)
+ {
+ //璁剧疆鎸夐敭闈㈡澘鎸囩ず鐏鑹插け璐�
+ string msg = Language.StringByID(R.MyInternationalizationString.uSetPanelPilolightSettionFail);
+ this.ShowErrorMsg(msg);
+ return false;
+ }
+ //澶囦唤璁惧
+ await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(panel, GatewayBackupEnum.A骞叉帴鐐归鑹茶皟鑺�, colorData);
+ return true;
+ }
+
+ /// <summary>
+ /// 璁剧疆闈㈡澘棰滆壊
+ /// </summary>
+ /// <param name="panel">鎸夐敭闈㈡澘鐨�</param>
+ /// <param name="colorData">鍙缃紑鐨勯鑹�</param>
+ /// <returns></returns>
+ public async Task<bool> SetPanelColorInfo(Panel panel, Panel.KeyColorData colorData)
+ {
+ var keyNum = new Panel.KeyNumStatus();
+ //榛樿绗竴涓敤闈㈡澘绗竴涓寜閿鑹蹭綔涓烘暣涓潰鏉跨殑棰滆壊
+ keyNum.Key1 = true;
var result = await panel.SetPanelColorInfoAsync(colorData, keyNum);
if (result == null || result.responseData == null)
{
@@ -205,6 +264,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鍙妭鑳芥ā寮�)
--
Gitblit v1.8.0