gxc
2020-01-10 c0021397eeb8335d6d1f20990c71533c3d94e7af
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs
@@ -136,12 +136,31 @@
        /// </summary>
        /// <param name="rollershade">窗帘对象</param>
        /// <param name="limiType">确认及覆盖上限位还是下限位</param>
        /// <param name="upLimit">上限位的值,百分比(备份用)</param>
        /// <param name="downLimit">下限位的值,百分比(备份用)</param>
        /// <param name="upLimit">上限位的值(长度值,不是百分比)</param>
        /// <param name="downLimit">下限位的值(长度值,不是百分比)</param>
        /// <returns></returns>
        public async Task<bool> CommitCurtainLimitPoint(Rollershade rollershade, Rollershade.CurtainPrivateInstalledLimi limiType, int upLimit, int downLimit)
        {
            var result = await rollershade.SetCurtainInstalledLimitAsync(limiType);
            CommonDevice.SetWritableValueResponAllData result = null;
            if (upLimit == -1 && upLimit == -1)
            {
                //这个是卷帘
                result = await rollershade.SetCurtainInstalledLimitAsync(limiType);
            }
            else
            {
                //这个是开合帘 "2,0x00ff,0x00ff"格式 合限位在前,开限位在后
                string convertData = "\"2,0x" + Convert.ToString(downLimit, 16).PadLeft(4, '0');
                convertData += ",0x" + Convert.ToString(upLimit, 16).PadLeft(4, '0') + "\"";
                //然后将它们转为ASK码数值,然后再转为16进制
                //总计长度为17(这里是16进制)
                string sendData = "11";
                foreach (char c in convertData)
                {
                    sendData += Convert.ToString((int)c, 16).PadLeft(2, '0');
                }
                result = await HdlDeviceAttributeLogic.Current.WriteDeviceAttribute(rollershade, 258, 24, 65, sendData);
            }
            //检测网关返回的共通错误状态码
            string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
            if (error != null)