From 72be4f06a683de33ddd563c8447c39f7f17e5b7d Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 06 一月 2020 13:03:50 +0800
Subject: [PATCH] 合并代码

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

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs
index 9801090..05038ca 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceCurtainLogic.cs
@@ -141,7 +141,29 @@
         /// <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
+            {
+                if (upLimit < 0) { upLimit = 0; }
+                if (downLimit < 0) { downLimit = 100; }
+
+                //杩欎釜鏄紑鍚堝笜 "2,0x00ff,0x00ff"鏍煎紡
+                string convertData = "\"2,0x" + Convert.ToString(upLimit, 16).PadLeft(4, '0');
+                convertData += ",0x" + Convert.ToString(downLimit, 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