Class CcsdsPacket

java.lang.Object
org.yamcs.tctm.CcsdsPacket
Direct Known Subclasses:
SimulatorCcsdsPacket

public class CcsdsPacket extends Object
CCSDS Packet as per CCSDS 133.0-B-2 https://public.ccsds.org/Pubs/133x0b2e1.pdf
 primary 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 Details

  • Constructor Details

    • CcsdsPacket

      public CcsdsPacket(byte[] packet)
    • CcsdsPacket

      public CcsdsPacket(ByteBuffer bb)
  • Method Details

    • wrap

      public static CcsdsPacket wrap(byte[] pkt)
    • 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 = absent
      tmtc - 0 = tm, 1 = tc
      seqFlags - grouping: 01 = first packet, 00 = continuation packet, 10 = last packet of group, 11 = unsegmented data
      seq -
    • setAPID

      public void setAPID(int apid)
    • getAPID

      public static short getAPID(ByteBuffer bb)
    • getCcsdsPacketLength

      public static int getCcsdsPacketLength(ByteBuffer bb)
    • getCcsdsPacketLength

      public int getCcsdsPacketLength()
    • setCcsdsPacketLength

      public void setCcsdsPacketLength(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)
    • getCcsdsPacketLength

      public static int getCcsdsPacketLength(byte[] buf)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • appendBinaryData

      protected void appendBinaryData(StringBuilder sb)