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

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.PnDecoder
All Implemented Interfaces:
FrameReceiver, Receiver, Sender, java.lang.Cloneable

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

This class performs pseudo-noise encoding/decoding on frames or blocks of data. Pseudo-Noise is also known as bit transition density. This class uses the standard CCSDS polynomial: x**8 + x**7 + x**5 + x**3 + 1.


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  int syncLength
           
private static int[] table
          This is the default encoding table, which is CCSDS-recommended.
 
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
PnDecoder()
          A null constructor.
 
Method Summary
static void decode(byte[] data, int startByte, int endByte)
          This method adds or removes pseudo-noise encoding (PN or bit transition density encoding) from a data block.
 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.
 void setSyncLength(int length)
          Set the sync pattern length.
 
Methods inherited from class gov.nasa.gsfc.drl.rtstps.core.FrameSenderNode
addReceiver, finishSetup, 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

table

private static final int[] table
This is the default encoding table, which is CCSDS-recommended. It is a 255 byte array. Gerald Grebowsky of GSFC gave me the table in 1996.


syncLength

private int syncLength
Constructor Detail

PnDecoder

public PnDecoder()
A null constructor.

Method Detail

load

public void load(org.w3c.dom.Element element,
                 Configuration configuration)
          throws RtStpsException
Set up this RT-STPS node with a configuration. PN does not have an element. It is created in the Frame Sync, so this required method does nothing.

Specified by:
load in class FrameSenderNode
Throws:
RtStpsException

setSyncLength

public void setSyncLength(int length)
Set the sync pattern length. The default length is 4 bytes.


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

public static void decode(byte[] data,
                          int startByte,
                          int endByte)
This method adds or removes pseudo-noise encoding (PN or bit transition density encoding) from a data block. The polynomial is the CCSDS- recommended one. This method both encodes and decodes; the operation depends on the original state of the data: encoded or decoded.

Parameters:
data - The byte array to be encoded or decoded.
startByte - The data index of the starting byte.
endByte - The data index of the last decoded byte.