HDL Home App 第二版本 旧平台金堂用 正在使用
hxb
2022-08-30 25429f085093d89d543a0b90e30d0d62d1b7dac9
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,代表是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,代表35%)</param>
        /// <returns></returns>
        public int CalculateLightLevel(decimal i_Persent)
        {
            //需要向上取整,才能得出
            return (int)Math.Ceiling((i_Persent / 100) * 255);
        }
        #endregion
    }
}