|  |  | 
 |  |  | import com.dy.common.mw.protocol.p206V2.CodeV2; | 
 |  |  | import com.dy.common.mw.protocol.p206V2.ParseParamsForDownV2; | 
 |  |  | import com.dy.common.mw.protocol.p206V2.ProtocolConstantV206V2; | 
 |  |  | import com.dy.common.mw.protocol.p206V2.parse.global.GlCreate; | 
 |  |  | import com.dy.common.mw.protocol.p206V1.parse.global.GlCreate; | 
 |  |  | import com.dy.common.softUpgrade.Com1601Vo; | 
 |  |  | import com.dy.common.util.ByteUtil; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |         midRs.downCodeName = CodeV2.getCodeName(para.commandCode) ;//下行命令功能码名称; | 
 |  |  |         midRs.downBuffer = bs ;//下行命令数据 | 
 |  |  |         midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//下行命令数据十六进制形式 | 
 |  |  |         midRs.hasResponse = true ;//是否有应答 | 
 |  |  |         midRs.hasResponse = false ;//是否有应答 | 
 |  |  |         midRs.maxSendTimes = null ;//命令最大发送次数(当收不到应答时,将重发),如果不设置,命令缓存器进行补充设置 | 
 |  |  |         midRs.isCachForOffLine = false ;//RTU不在线,命令是否缓存,低功耗时为true | 
 |  |  |  | 
 |  |  |         midRs.isFastCom = true ;//速发命令,下发数据时间间隔受小值(配置文件中fastCommandSendInterval)限制 | 
 |  |  |         midRs.countdown4Send = 1 ;//倒计时,当此值为小于等于0时才会下发,否则逐次减1 | 
 |  |  |  | 
 |  |  |         if(isLowPower != null && isLowPower.booleanValue()){ | 
 |  |  |             //低功耗时,尽快发送 | 
 |  |  | 
 |  |  |         index += 2 ; | 
 |  |  |         GlCreate.createRtuAddr4PUg(para.rtuAddr, preBytes, index); | 
 |  |  |  | 
 |  |  |         byte[] bytes = ByteUtil.bytesMerge(preBytes, (byte[])para.attachment) ; | 
 |  |  |         if(para.param == null){ | 
 |  |  |             throw new Exception("参数为空") ; | 
 |  |  |         } | 
 |  |  |         if(!(para.param instanceof Com1601Vo)){ | 
 |  |  |             throw new Exception("参数类型非Com1601Vo") ; | 
 |  |  |         } | 
 |  |  |         Com1601Vo vo = (Com1601Vo) para.param ; | 
 |  |  |         byte[] bs = new byte[4] ; | 
 |  |  |         ByteUtil.hex2Bytes(vo.softStoreAddr, bs, 0) ; | 
 |  |  |         byte[] bytes = ByteUtil.bytesMerge(preBytes, bs) ; | 
 |  |  |  | 
 |  |  |         bs = new byte[4] ; | 
 |  |  |         ByteUtil.int2Bytes_BE(bs, vo.totalByte, 0); | 
 |  |  |         bytes = ByteUtil.bytesMerge(bytes, bs) ; | 
 |  |  |  | 
 |  |  |         bs = new byte[2] ; | 
 |  |  |         ByteUtil.short2Bytes_BE(bs, (short)vo.softCrc, 0); | 
 |  |  |         bytes = ByteUtil.bytesMerge(bytes, bs) ; | 
 |  |  |  | 
 |  |  |         bs = new byte[2] ; | 
 |  |  |         ByteUtil.short2Bytes_BE(bs, (short)vo.softCrc, 0); | 
 |  |  |         bytes = ByteUtil.bytesMerge(bytes, bs) ; | 
 |  |  |  | 
 |  |  |         bs = new byte[4] ; | 
 |  |  |         ByteUtil.hex2Bytes(vo.softStartAddr, bs, 0) ; | 
 |  |  |         bytes = ByteUtil.bytesMerge(bytes, bs) ; | 
 |  |  |  | 
 |  |  |         GlCreate.createLen4PUg(bytes);//长度放字节数组中 | 
 |  |  |  | 
 |  |  |         byte[] bsTail = GlCreate.createCrcTail4Ug(bytes) ;//CRC和尾叠加字节数组中 | 
 |  |  |  |