Class CucTimeDecoder

  • All Implemented Interfaces:
    TimeDecoder

    public class CucTimeDecoder
    extends Object
    implements TimeDecoder
    Decoder for CCSDS Unsegmented time Code as specified in TIME CODE FORMATS, CCSDS 301.0-B-4, Nov 2010 The time code is composed by
    • P-Field (preamble field) 8 or 16 bits optional
    • T-Field - up to 7+10 bytes (although it could be longer for custom codes)
    • Constructor Detail

      • CucTimeDecoder

        public CucTimeDecoder​(int pfield1)
      • CucTimeDecoder

        public CucTimeDecoder​(int pfield1,
                              int pfield2)
        Constructor for decoder.
        Parameters:
        pfield1 - first octet of the pfield -1 means is part of the packet, other values means it is pre-defined (implicit)
        pfield2 - second octet of the pfield - used if the first bit of pfield1 (seen as one byte) is 1
    • Method Detail

      • decode

        public long decode​(ByteSupplier s)
        Assuming that the basic time unit is second, return the number of milliseconds.
        Specified by:
        decode in interface TimeDecoder
        Parameters:
        s - - the bytes will be read from here.
        Returns:
        time in milliseconds
      • decodeRaw

        public long decodeRaw​(ByteSupplier s)
        Decodes the time in the highest available resolution.

        If the length of the basicTime and fractional time is greater than 8, an exception is thrown.

        Specified by:
        decodeRaw in interface TimeDecoder
        Parameters:
        s - - the bytes will be read from here.
        Returns:
        time