黄学彪
2019-12-30 3dcbd186c42c598c0c08d1cd37034cf2baa09e54
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;
                    }
                }