gov.nasa.gsfc.drl.rtstps.core
Class CrcDecoder

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.RtStpsNode
      extended by gov.nasa.gsfc.drl.rtstps.core.FrameSenderNode
          extended by gov.nasa.gsfc.drl.rtstps.core.CrcDecoder
All Implemented Interfaces:
FrameReceiver, Receiver, Sender, java.lang.Cloneable

public final class CrcDecoder
extends FrameSenderNode
implements FrameReceiver, Sender, java.lang.Cloneable

This class performs CRC decoding on frames or blocks of data.


Field Summary
static java.lang.String CLASSNAME
          This is a class name for this RT-STPS node type, which is also the element name.
private  boolean discardBadFrames
          If true, discard a frame with a bad CRC.
private  int firstData
           
private static int[] highCRC
           
private  int highStart
           
private  boolean includeSyncPattern
          If true, include the sync pattern in the CRC calculation.
private  int lastData
           
private static int[] lowCRC
           
private  int lowStart
           
private  int offsetToParity
          This is the byte offset from the frame start to the first byte of CRC parity, which is 2 bytes.
private  int parityStart
           
 
Fields inherited from class gov.nasa.gsfc.drl.rtstps.core.FrameSenderNode
output
 
Fields inherited from class gov.nasa.gsfc.drl.rtstps.core.RtStpsNode
linkName, statusItemList, typeName
 
Constructor Summary
CrcDecoder()
          Create a CRC decoder.
 
Method Summary
private  boolean decode(Frame frame)
          Decode the frame.
 void finishSetup(Configuration configuration)
          Finish the setup.
 void load(org.w3c.dom.Element element, Configuration configuration)
          Set up this RT-STPS node with a configuration.
 void putFrame(Frame frame)
          Give a frame to this FrameReceiver.
 void putFrames(Frame[] frames)
          Give an array of frames to this FrameReceiver.
 
Methods inherited from class gov.nasa.gsfc.drl.rtstps.core.FrameSenderNode
addReceiver, flush, setOutputIsRequired
 
Methods inherited from class gov.nasa.gsfc.drl.rtstps.core.RtStpsNode
clear, clone, getElementName, getLinkName, getStatusItems, setLinkName, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nasa.gsfc.drl.rtstps.core.FrameReceiver
flush, getLinkName
 
Methods inherited from interface gov.nasa.gsfc.drl.rtstps.core.Sender
addReceiver
 

Field Detail

CLASSNAME

public static final java.lang.String CLASSNAME
This is a class name for this RT-STPS node type, which is also the element name. It is not necessarily the link name, which is the name of one particular object.

See Also:
Constant Field Values

highCRC

private static final int[] highCRC

lowCRC

private static final int[] lowCRC

highStart

private int highStart

lowStart

private int lowStart

firstData

private int firstData

lastData

private int lastData

parityStart

private int parityStart

includeSyncPattern

private boolean includeSyncPattern
If true, include the sync pattern in the CRC calculation.


discardBadFrames

private boolean discardBadFrames
If true, discard a frame with a bad CRC.


offsetToParity

private int offsetToParity
This is the byte offset from the frame start to the first byte of CRC parity, which is 2 bytes. In general, the CRC parity follows the frame data but precedes any Reed Solomon parity. If zero, the software calculates the value.

Constructor Detail

CrcDecoder

public CrcDecoder()
Create a CRC decoder.

Method Detail

load

public void load(org.w3c.dom.Element element,
                 Configuration configuration)
          throws RtStpsException
Set up this RT-STPS node with a configuration.

Specified by:
load in class FrameSenderNode
Throws:
RtStpsException

finishSetup

public void finishSetup(Configuration configuration)
                 throws RtStpsException
Finish the setup. When this method is called, you may assume all nodes have been created and exist by name in the map, and all standard links have been resolved. This is a last chance to prepare for data flow.

Overrides:
finishSetup in class FrameSenderNode
Throws:
RtStpsException

putFrames

public void putFrames(Frame[] frames)
               throws RtStpsException
Give an array of frames to this FrameReceiver.

Specified by:
putFrames in interface FrameReceiver
Throws:
RtStpsException

putFrame

public void putFrame(Frame frame)
              throws RtStpsException
Give a frame to this FrameReceiver.

Specified by:
putFrame in interface FrameReceiver
Throws:
RtStpsException

decode

private boolean decode(Frame frame)
Decode the frame. The method marks the frame's annotation.

Returns:
true if it computed a CRC error