| | |
| | | if(taskVo.softStartAddr == null || taskVo.softStartAddr.trim().length() != 8){ |
| | | throw new Exception("程序覆盖起始地址不合法,必须是8字符(十六进制)的字符串") ; |
| | | } |
| | | if(taskVo.softFileData == null || taskVo.softFileData.length <= 0){ |
| | | if(taskVo.softFileData64 == null || taskVo.softFileData64.trim().length() == 0){ |
| | | throw new Exception("升级程序内容必须提供") ; |
| | | } |
| | | if(taskVo.softBytesCalculate == null){ |
| | |
| | | this.taskVo = taskVo ; |
| | | |
| | | this.upgradeRtus = new HashMap<>(); |
| | | if(taskVo.softFileData != null && taskVo.softFileData.length >0){ |
| | | if(taskVo.softFileData64 != null && taskVo.softFileData64.trim().equals("")){ |
| | | taskVo.softFileData = Base64.getDecoder().decode(taskVo.softFileData64); |
| | | List<byte[]> listBytes = new HexFileParse().splitBytesByUnit512(taskVo.softFileData); |
| | | this.softFileDataGrp = listBytes.toArray(new byte[0][]); |
| | | for(String rtuAddr : this.taskVo.rtuAddrList){ |
| | | //此时状态设置成离线状态 |
| | | UpgradeRtuDev ugRtu = new UpgradeRtuDev(this, rtuAddr, this.taskVo.softFileData.length, UpgradeRtuDev.STATE_OFFLINE) ; |
| | | UpgradeRtuDev ugRtu = new UpgradeRtuDev(this, rtuAddr, this.softFileDataGrp.length, UpgradeRtuDev.STATE_OFFLINE) ; |
| | | this.upgradeRtus.put(rtuAddr, ugRtu) ; |
| | | } |
| | | } |
| | |
| | | if(this.upgradeRtus != null && this.upgradeRtus.size() > 0){ |
| | | Collection<UpgradeRtu> col = this.upgradeRtus.values() ; |
| | | for(UpgradeRtu info : col){ |
| | | if(info.state == UpgradeRtuDev.STATE_OFFLINE){ |
| | | if(info.state == UpgradeRtu.STATE_OFFLINE){ |
| | | state.offLineTotal ++ ; |
| | | }else if(info.state == UpgradeRtuDev.STATE_UNSTART){ |
| | | }else if(info.state == UpgradeRtu.STATE_UNSTART){ |
| | | state.unStartTotal ++ ; |
| | | }else if(info.state == UpgradeRtuDev.STATE_RUNNING){ |
| | | }else if(info.state == UpgradeRtu.STATE_RUNNING){ |
| | | state.runningTotal ++ ; |
| | | }else if(info.state == UpgradeRtuDev.STATE_SUCCESS) { |
| | | }else if(info.state == UpgradeRtu.STATE_SUCCESS) { |
| | | state.successTotal++; |
| | | }else if(info.state == UpgradeRtuDev.STATE_FAILONE) { |
| | | }else if(info.state == UpgradeRtu.STATE_FAILONE) { |
| | | state.failOneTotal++; |
| | | state.failTotal++; |
| | | }else if(info.state == UpgradeRtuDev.STATE_FAIL) { |
| | | }else if(info.state == UpgradeRtu.STATE_FAIL) { |
| | | state.failTotal++; |
| | | } |
| | | if(info.isOver){ |