Class CucTimeEncoder

java.lang.Object
org.yamcs.tctm.ccsds.time.CucTimeEncoder
All Implemented Interfaces:
TimeEncoder

public class CucTimeEncoder extends Object implements TimeEncoder
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Log
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CucTimeEncoder(int pfield1, boolean implicitPfield)
     
    CucTimeEncoder(int pfield1, int pfield2, boolean implicitPfield)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    encode(long time, byte[] buf, int offset)
    Encodes the Yamcs instant into the binary buffer.
    int
    encodeRaw(long time, byte[] buf, int offset)
    Encodes the time in an unspecified unit.
    int
    Returns the size in bytes of the encoded time.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • log

      public static final Log log
  • Constructor Details

    • CucTimeEncoder

      public CucTimeEncoder(int pfield1, boolean implicitPfield)
    • CucTimeEncoder

      public CucTimeEncoder(int pfield1, int pfield2, boolean implicitPfield)
  • Method Details

    • encode

      public int encode(long time, byte[] buf, int offset)
      Description copied from interface: TimeEncoder
      Encodes the Yamcs instant into the binary buffer.

      It is assumed that the buffer will have enough space; if not, an ArrayIndexOutOfBoundsException will be thrown.

      Specified by:
      encode in interface TimeEncoder
      Parameters:
      time - - time in milliseconds to be encoded
      buf - - where to write the encoded time
      offset - - offset in the buffer where the encoding will begin
      Returns:
      the number of bytes encoded
    • encodeRaw

      public int encodeRaw(long time, byte[] buf, int offset)
      Description copied from interface: TimeEncoder
      Encodes the time in an unspecified unit.

      This can be used when the on-board time is free running.

      It is assumed that the buffer will have enough space; if not, an ArrayIndexOutOfBoundsException will be thrown.

      Specified by:
      encodeRaw in interface TimeEncoder
      Parameters:
      time - - time in unspecified units to be encoded
      buf - - where to write the encoded time
      offset - - offset in the buffer where the encoding will begin
      Returns:
      the number of bytes encoded
    • toString

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

      public int getEncodedLength()
      Description copied from interface: TimeEncoder
      Returns the size in bytes of the encoded time.

      If the size is variable return -1

      Specified by:
      getEncodedLength in interface TimeEncoder