From c0021397eeb8335d6d1f20990c71533c3d94e7af Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 10 一月 2020 17:02:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into DEV_GXC

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs
index 9801090..c7b8dc2 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs
+++ b/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') + "\"";
+                //鐒跺悗灏嗗畠浠浆涓篈SK鐮佹暟鍊�,鐒跺悗鍐嶈浆涓�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)

--
Gitblit v1.8.0