| | |
| | | bsNoTail[ProtocolConstantV206V1.dataLenIndex] = (byte)len ; |
| | | } |
| | | |
| | | public static void createLen4PUg(byte[] bytes) throws Exception { |
| | | int len = bytes.length - 4; |
| | | byte[] bs = ByteUtil.int2BCD_LE(len) ; |
| | | if(bs != null && bs.length == 1){ |
| | | bytes[1] = bs[0] ; |
| | | }else if(bs != null && bs.length > 1){ |
| | | bytes[1] = bs[0] ; |
| | | bytes[2] = bs[1] ; |
| | | } |
| | | } |
| | | |
| | | public static byte[] createCrcTail(byte[] bsNoTail) throws Exception { |
| | | int crc = new CRC8_for_2_0().CRC8(bsNoTail, ProtocolConstantV206V1.ctrlIndex, bsNoTail.length -1) ; |
| | | byte[] bytes = new byte[ProtocolConstantV206V1.lenTail] ; |