Esp3PacketHeader { public int getDataLength() { return dataLength; } Esp3PacketHeader(byte[] headerData);  Esp3PacketHeader(PacketType packetType, int dataLength, int optionalDataLength); @Override String toString(); int getDataLength(); int getOptionalDataLength(); PacketType getPacketType(); byte[] asByteArray(); int getPacketSize(); static final byte ESP3_SYNC_BYTE; static final int ESP3_HEADER_SIZE; static final int ESP3_HEADER_SYNC_BYTE_INDEX; static final int ESP3_HEADER_DATA_LENGTH_HIBYTE_INDEX; static final int ESP3_HEADER_DATA_LENGTH_LOBYTE_INDEX; static final int ESP3_HEADER_OPTIONAL_DATA_LENGTH_INDEX; static final int ESP3_HEADER_PACKET_TYPE_INDEX; static final int ESP3_HEADER_CRC8_INDEX; }
@Test public void testDataLength() throws Exception { int dataLength = 0x1FF; byte[] headerData = headerAsByteArray( dataLength, 1, Esp3PacketHeader.PacketType.RADIO ); Esp3PacketHeader header = new Esp3PacketHeader(headerData); Assert.assertTrue(header.getDataLength() == dataLength); }