From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 30 八月 2022 09:37:38 +0800 Subject: [PATCH] 合并了IOS的代码 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs | 48 +++++++++++++++++++++++++++++++++++++----------- 1 files changed, 37 insertions(+), 11 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs index f09249f..68de7b7 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCommonLogic.cs @@ -146,6 +146,18 @@ //鍙戦�佹暟鎹� myGateway.Send(sendTopic, sendData); + //瓒呮椂鏃堕棿 + int TimeOut = 0; + waitTime = 20 * waitTime; + while (listCheckTopic.Count != listReceiptTopic.Count && TimeOut < waitTime) + { + //鍏ㄩ儴鎺ユ敹鎵嶉��鍑� + System.Threading.Thread.Sleep(50); + TimeOut++; + } + myGateway.Actions -= receiptAction; + receiptAction = null; + int receveCount = listCheckTopic.Count; if (receveCount > 1) { @@ -161,17 +173,6 @@ receveCount = listTemp.Count; } - //瓒呮椂鏃堕棿 - int TimeOut = 0; - waitTime = 20 * waitTime; - while (receveCount != listReceiptTopic.Count && TimeOut < waitTime) - { - //鍏ㄩ儴鎺ユ敹鎵嶉��鍑� - System.Threading.Thread.Sleep(50); - TimeOut++; - } - myGateway.Actions -= receiptAction; - receiptAction = null; if (receveCount != listReceiptTopic.Count) { reResult.ErrorMsgDiv = 0; @@ -306,5 +307,30 @@ } #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 璁$畻鐏殑浜害鍊兼墍鍗犵殑鐧惧垎姣�(渚嬪:杩斿洖35,浠h〃鏄�35%) + /// </summary> + /// <param name="i_Level">鐏殑浜害鍊�</param> + /// <returns></returns> + public int CalculateLightLevelPersent(decimal i_Level) + { + return (int)((i_Level / 255) * 100); + } + + /// <summary> + /// 璁$畻鎸囧畾鐧惧垎姣斿搴旂伅鐨勪寒搴﹀�� + /// </summary> + /// <param name="i_Persent">鐧惧垎姣斿��(姣斿35,浠h〃35%)</param> + /// <returns></returns> + public int CalculateLightLevel(decimal i_Persent) + { + //闇�瑕佸悜涓婂彇鏁�,鎵嶈兘寰楀嚭 + return (int)Math.Ceiling((i_Persent / 100) * 255); + } + + #endregion } } -- Gitblit v1.8.0