| | |
| | | bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; |
| | | |
| | | index++ ; |
| | | bsHead[index] = commonV1_0_1.createCtrl((byte)0) ; |
| | | bsHead[index] = commonV1_0_1.createCtrl((byte)0, (byte)0) ; |
| | | |
| | | index++ ; |
| | | GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); |
| | |
| | | |
| | | GlCreate.createLen(bytes);//长度放字节数组中 |
| | | |
| | | bytes = GlCreate.createCrcTail(bytes) ;//CRC和尾叠加字节数组中 |
| | | byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC和尾叠加字节数组中 |
| | | |
| | | bytes = ByteUtil.bytesMerge(bytes, bsTail) ; |
| | | |
| | | return bytes ; |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception{ |
| | | ParseParamsForDownV1_0_1 p = new ParseParamsForDownV1_0_1() ; |
| | | p.commandCode = "02" ; |
| | | p.rtuAddr = "9672950001"; |
| | | |
| | | Cd_02_Down obj = new Cd_02_Down() ; |
| | | byte[] bs = obj.doParse(p) ; |
| | | |
| | | String hex1 = ByteUtil.bytes2Hex(bs,true) ; |
| | | String hex2 = ByteUtil.bytes2Hex(bs,false) ; |
| | | |
| | | System.out.println(hex1); |
| | | System.out.println(hex2); |
| | | } |
| | | |
| | | } |