From 2eacb04ca1ec0ad20fda4186b59a9bce67004cb4 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期四, 30 四月 2020 17:45:33 +0800 Subject: [PATCH] 请合并小模块 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 116 insertions(+), 4 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs old mode 100755 new mode 100644 index 8c56b72..1d6dd1b --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs @@ -90,7 +90,7 @@ public async Task<bool> SetPanelEpointColorInfo(Panel panel, Panel.KeyColorData colorData) { var keyNum = new Panel.KeyNumStatus(); - Type type = keyNum.GetType(); + 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); @@ -111,10 +111,41 @@ //澶囦唤璁惧 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) + { + //璁剧疆鎸夐敭闈㈡澘鎸囩ず鐏鑹插け璐� + 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; + } + #endregion - + #region 鈻� 浜害璋冭妭___________________________ /// <summary> /// 鑾峰彇璁惧浜害閰嶇疆锛坲i鍙寒搴﹁皟鑺�,浣跨敤杩斿洖鍊肩殑panelDirectionsLevel锛� @@ -205,6 +236,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