| | |
| | | // 5D4D5D4D |
| | | // 00004000 |
| | | // AAC616" ; |
| | | String hex = "AA0024AA16015301150599800001100000014A005D4D5D4D00004000" ; |
| | | String hex = "AA0018AA16015301150599800001100000014A005D4D5D4D00004000" ; |
| | | byte[] bs = ByteUtil.hex2Bytes(hex) ; |
| | | // for(int i = 0 ; i < bs.length - 2 ; i++){ |
| | | // short crc = new CRC16().CRC16_table(bs, i , bs.length - 1) ; |
| | | // byte[] bytes = new byte[ProtocolConstantV206V1.UG_lenTail] ; |
| | | // ByteUtil.short2Bytes_LE(bytes, crc, 0); |
| | | // bytes[2] = ProtocolConstantV206V1.P_Tail_Byte ; |
| | | // System.out.println(ByteUtil.bytes2Hex(bytes, true)) ; |
| | | // } |
| | | System.out.println("==============================") ; |
| | | for(int i = 4 ; i < bs.length ; i++){ |
| | | short crc = new CRC16().CRC16_table(bs, 0 , i) ; |
| | | for(int i = 0 ; i < bs.length - 2 ; i++){ |
| | | short crc = new CRC16().CRC16_table(bs, i , bs.length - 1) ; |
| | | byte[] bytes = new byte[ProtocolConstantV206V1.UG_lenTail] ; |
| | | ByteUtil.short2Bytes_LE(bytes, crc, 0); |
| | | bytes[2] = ProtocolConstantV206V1.P_Tail_Byte ; |
| | | System.out.println(ByteUtil.bytes2Hex(bytes, true)) ; |
| | | } |
| | | // System.out.println("==============================") ; |
| | | // for(int i = 4 ; i < bs.length ; i++){ |
| | | // short crc = new CRC16().CRC16_table(bs, 0 , i) ; |
| | | // byte[] bytes = new byte[ProtocolConstantV206V1.UG_lenTail] ; |
| | | // ByteUtil.short2Bytes_LE(bytes, crc, 0); |
| | | // bytes[2] = ProtocolConstantV206V1.P_Tail_Byte ; |
| | | // System.out.println(ByteUtil.bytes2Hex(bytes, true)) ; |
| | | // } |
| | | } |
| | | |
| | | } |