Class AbstractPacketPreprocessor

java.lang.Object
org.yamcs.tctm.AbstractPacketPreprocessor
All Implemented Interfaces:
PacketPreprocessor
Direct Known Subclasses:
CcsdsPacketPreprocessor, CspPacketPreprocessor, GenericPacketPreprocessor

public abstract class AbstractPacketPreprocessor extends Object implements PacketPreprocessor
This class provides some common facilities for the packet preprocessors. Options:
   dataLinks:
   ...
      packetPreprocessor: org.yamcs.tctm.concrete_classname
      packetPreprocessorArgs:
          byteOrder: LITTLE_ENDIAN
          checkSequence: true
          timeEncoding:
              epoch: CUSTOM
              epochUTC: 1970-01-01T00:00:00Z
              timeIncludesLeapSeconds: false
 
 
The byteOrder option (default is BIG_ENDIAN) is used by some implementing classes to decode parts of the header.

The checkSequence option (default is true) can configure the implementing classes to raise an event if the sequence count is not continuous (this indicates packet loss).

The timeEncoding is used to convert the extracted time to Yamcs time. epoch can be one of TAI, J2000, UNIX, GPS, CUSTOM.

If CUSTOM is specified, the epochUTC has to be used to specify the UTC time which is used as an epoch (UTC is used here loosely because strictly speaking UTC has been only introduced in 1972 so it does not make sense for the times before).

The time read from the packet is interpreted as delta from epochUTC.

If timeIncludesLeapSeconds is true (default), the delta time is considered as having the leap seconds included (practically it is the real time that passed).

TAI, J2000 and GPS have the leap seconds included, UNIX does not.

The example above is equivalent with:

 timeEncoding:
    epoch: UNIX
 
If this option is not configured, the default will be different for each pre-processor.
  • Field Details

  • Constructor Details

    • AbstractPacketPreprocessor

      protected AbstractPacketPreprocessor(String yamcsInstance, YConfiguration config)
  • Method Details

    • verifyCrc

      public void verifyCrc(TmPacket tmPacket)
    • getErrorDetectionWordCalculator

      public static ErrorDetectionWordCalculator getErrorDetectionWordCalculator(YConfiguration config)
    • setRealtimePacketTime

      protected void setRealtimePacketTime(TmPacket tmPacket, int offset)
      Decodes the time at the offset using the time decoder, sets and verifies the generation time depending on the timeEpoch and the tcoService.

      If there is any exception when decoding the time, the packet is marked as invalid.

      It is important this is called only for realtime packets.

      Parameters:
      tmPacket -
      offset -
    • shiftFromEpoch

      protected long shiftFromEpoch(long t)
    • getByteOrder

      public static ByteOrder getByteOrder(YConfiguration config)
    • getDefaultDecoderType

      protected AbstractPacketPreprocessor.TimeDecoderType getDefaultDecoderType()
      return the default decoder type. The subclasses may override this for compatibility with old Yamcs releases
    • checkForSequenceDiscontinuity

      public boolean checkForSequenceDiscontinuity()
    • checkForSequenceDiscontinuity

      public void checkForSequenceDiscontinuity(boolean checkForSequenceDiscontinuity)
      Description copied from interface: PacketPreprocessor
      The packet preprocessor processes multiple packets that should be in sequence. This flag can be used to check that indeed the packets are in sequence and produce a warning otherwise.
      Specified by:
      checkForSequenceDiscontinuity in interface PacketPreprocessor