Class PacketDecoder
Space Packet Protocol CCSDS 133.0-B-1 September 2003.
The first 3 bits of these packets are 000.
The header is 6 bytes and the last two bytes of the header represent the size of the packet (including the header) - 7.
The minimum packet length is 7 bytes.
Encapsulation Service. CCSDS 133.1-B-2. October 2009.
The first 3 bits of these packets are 111.
The minimum packet length is 1 byte.
Depending on the last 2 bits of the first byte, the size of the header can be 1,2,4 or 8 bytes with the length of the packet read from the last 0,1,2 or 4 header bytes respectively
The two types can be both present on the same stream.
The objects of this class can processes one "stream" at a time and they are not thread safe!
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
void
process
(byte[] data, int offset, int length) void
reset()
Removes a partial packet if anyboolean
void
skipIdlePackets
(boolean skipIdlePackets) Skip or not the idle packets.boolean
void
stripEncapsulationHeader
(boolean stripEncapsulationHeader) If set to true, the encapsulation header will be stripped out.
-
Constructor Details
-
PacketDecoder
-
-
Method Details
-
process
- Throws:
TcTmException
-
reset
public void reset()Removes a partial packet if any -
hasIncompletePacket
public boolean hasIncompletePacket()- Returns:
- true of the decoder is in the middle of a packet decoding
-
skipIdlePackets
public boolean skipIdlePackets()- Returns:
- true of the idle packets are skipped (i.e. not sent to the consumer)
-
skipIdlePackets
public void skipIdlePackets(boolean skipIdlePackets) Skip or not the idle packets. If true (default), the idle packets are not sent to the consumer.- Parameters:
skipIdlePackets
-
-
stripEncapsulationHeader
public boolean stripEncapsulationHeader()- Returns:
- true if the header of the encapsulated packets will be stripped out.
-
stripEncapsulationHeader
public void stripEncapsulationHeader(boolean stripEncapsulationHeader) If set to true, the encapsulation header will be stripped out. This means:- the Protocol ID information will be lost.
- an empty array buffer will be delivered for the one byte packets (or any other packet of size 0)
- Parameters:
stripEncapsulationHeader
-
-