From 3dcbd186c42c598c0c08d1cd37034cf2baa09e54 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 30 十二月 2019 15:47:51 +0800 Subject: [PATCH] 合并了代码 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs index d137ebb..96f45ff 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs @@ -312,6 +312,8 @@ int startIndex = 0; int allDataLength = this.deviceFirmwareByte.Length; int timeOut = 0; + //鏄惁鎺ユ敹鍒版垚鍔熷懡浠� + bool receiveSuccess = false; //鎺ユ敹缃戝叧鐨勯�忎紶鏁版嵁 bool hadReceive = true; @@ -338,14 +340,26 @@ //璁剧疆杩涘害鍊� this.SetProgressValue(startIndex, allDataLength); } + else if (command == "025e") + { + //鎴愬姛 璁剧疆杩涘害鍊肩洿鎺�100% + this.SetProgressValue(allDataLength, allDataLength); + receiveSuccess = true; + timeOut = 0; + } } catch { } }; this.zbGateway.ReportAction += receiveAction; //鏈�鍚庝竴娆¢渶瑕佺瓑寰呭洖澶嶇粨鏋滄墠寰�涓嬭蛋 - while (startIndex < allDataLength || hadReceive == false) + while (startIndex < allDataLength) { + if (receiveSuccess == true) + { + //宸茬粡鎺ユ敹鍒版垚鍔熺殑鍛戒护 + break; + } if (hadReceive == false) { timeOut++; @@ -365,6 +379,13 @@ continue; } hadReceive = false; + //鍥犱负鍋忕Щ閲忔槸楂樹綅鍦ㄥ墠锛屾墍浠ュ�掕繃鏉� + string Myoffset = string.Empty; + for (int i = 6; i >= 0; i = i - 2) + { + Myoffset += i_offset.Substring(i, 2); + } + startIndex = Convert.ToInt32(Myoffset, 16) - i_dataLength; //鑾峰彇涓�娆¤兘澶熷彂閫佺殑byte var listData = new List<byte>(); @@ -373,8 +394,6 @@ listData.Add(this.deviceFirmwareByte[startIndex]); if (listData.Count == i_dataLength) { - //寰�涓嬩竴浣嶆帹绉� - startIndex++; break; } } -- Gitblit v1.8.0