Package org.yamcs.tctm
Class CcsdsPacket
- java.lang.Object
-
- org.yamcs.tctm.CcsdsPacket
-
public class CcsdsPacket extends Object
CCSDS Packet as per CCSDS 133.0-B-2 https://public.ccsds.org/Pubs/133x0b2e1.pdfprimary header (6 bytes): 3 bit = version - 0 1 bit = type (0 = TM, 1= TC) 1 bit = 2nd header present 11 bit = apid 2 bit = grouping, 01 = first, 00 = cont, 10 = last packet of group, 11 = unsegmented data 14 bit = seq 16 bit = packet length (excluding primary header) minus 1
-
-
Field Summary
Fields Modifier and Type Field Description protected ByteBufferbb
-
Constructor Summary
Constructors Constructor Description CcsdsPacket(byte[] packet)CcsdsPacket(ByteBuffer bb)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendBinaryData(StringBuilder sb)intgetAPID()static shortgetAPID(byte[] packet)static shortgetAPID(ByteBuffer bb)ByteBuffergetByteBuffer()byte[]getBytes()intgetCccsdsPacketLength()static intgetCccsdsPacketLength(byte[] buf)static intgetCccsdsPacketLength(ByteBuffer bb)booleangetChecksumIndicator()static booleangetChecksumIndicator(byte[] packet)longgetCoarseTime()intgetLength()returns the length of the packet, normally equals ccsdslength+7intgetSecondaryHeaderFlag()static booleangetSecondaryHeaderFlag(byte[] packet)intgetSequenceCount()static intgetSequenceCount(byte[] packet)static shortgetSequenceCount(ByteBuffer bb)intgetTimeId()voidsetAPID(int apid)voidsetCccsdsPacketLength(short length)voidsetHeader(int apid, int tmtc, int secHeaderPresent, int seqFlags, int seq)Write the header.voidsetSequenceCount(short seqCount)StringtoString()
-
-
-
Field Detail
-
bb
protected ByteBuffer bb
-
-
Constructor Detail
-
CcsdsPacket
public CcsdsPacket(byte[] packet)
-
CcsdsPacket
public CcsdsPacket(ByteBuffer bb)
-
-
Method Detail
-
getSecondaryHeaderFlag
public int getSecondaryHeaderFlag()
-
getSecondaryHeaderFlag
public static boolean getSecondaryHeaderFlag(byte[] packet)
-
getSequenceCount
public int getSequenceCount()
-
getSequenceCount
public static int getSequenceCount(byte[] packet)
-
setSequenceCount
public void setSequenceCount(short seqCount)
-
getSequenceCount
public static short getSequenceCount(ByteBuffer bb)
-
getAPID
public int getAPID()
-
setHeader
public void setHeader(int apid, int tmtc, int secHeaderPresent, int seqFlags, int seq)Write the header. The grouping is set to 10b = last packet in the group and the length to the capacity of the buffer (minus 7)- Parameters:
apid-secHeaderPresent- 1 = present, 0 = absenttmtc- 0 = tm, 1 = tcseqFlags- grouping: 01 = first packet, 00 = continuation packet, 10 = last packet of group, 11 = unsegmented dataseq-
-
setAPID
public void setAPID(int apid)
-
getAPID
public static short getAPID(ByteBuffer bb)
-
getCccsdsPacketLength
public static int getCccsdsPacketLength(ByteBuffer bb)
-
getCccsdsPacketLength
public int getCccsdsPacketLength()
-
setCccsdsPacketLength
public void setCccsdsPacketLength(short length)
-
getLength
public int getLength()
returns the length of the packet, normally equals ccsdslength+7
-
getCoarseTime
public long getCoarseTime()
- Returns:
- time in seconds since 6 Jan 1980
-
getTimeId
public int getTimeId()
-
getChecksumIndicator
public boolean getChecksumIndicator()
-
getChecksumIndicator
public static boolean getChecksumIndicator(byte[] packet)
-
getBytes
public byte[] getBytes()
-
getByteBuffer
public ByteBuffer getByteBuffer()
-
getAPID
public static short getAPID(byte[] packet)
-
getCccsdsPacketLength
public static int getCccsdsPacketLength(byte[] buf)
-
appendBinaryData
protected void appendBinaryData(StringBuilder sb)
-
-