Terrenus HRPT v2.2

terrenus.telemetry
Class CHRPTDecoder

java.lang.Object
  extended by terrenus.telemetry.CHRPTDecoder
All Implemented Interfaces:
TelemetryDecoder

public class CHRPTDecoder
extends java.lang.Object
implements TelemetryDecoder

The CHRPTDecoder class uses a CHRPTStream to decode CMA CHRPT data.


Constructor Summary
CHRPTDecoder(CHRPTStream stream)
          Create a new decoder using the specified stream.
 
Method Summary
 int getAuxSyncErrors(int frame)
          Gets the number of errors in the frame auxiliary sync bits, or 0 if no errors are present.
 InstrumentData getData(int frame, Instrument inst)
          Gets the frame data for a specific instrument.
 int getDayCount(int frame)
          Gets the frame day count.
 int getFrameSyncErrors(int frame)
          Gets the number of errors in the frame sync bits, or 0 if no errors are present.
 int getMillisecond(int frame)
          Gets the frame millisecond.
static int getMillisecond(short[] timeCode)
          Gets the millisecond based on CHRPT time code data.
 Spacecraft getSpacecraft()
          Gets the spacecraft detected by this decoder.
 int getSpacecraftId()
          Gets the spacecraft address identified for this CHRPT data.
 int getSpacecraftId(int frame)
          Gets the spacecraft address for the frame.
 CHRPTStream getStream()
          Gets the telemetry stream used for data.
 long getTime(int frame)
          Gets the start time of frame capture in milliseconds since the epoch.
 boolean hasErrors(int frame)
          Gets the frame error flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CHRPTDecoder

public CHRPTDecoder(CHRPTStream stream)
             throws java.io.IOException
Create a new decoder using the specified stream.

Throws:
java.io.IOException
Method Detail

hasErrors

public boolean hasErrors(int frame)
                  throws java.io.IOException
Description copied from interface: TelemetryDecoder
Gets the frame error flag.

Specified by:
hasErrors in interface TelemetryDecoder
Parameters:
frame - the frame to return the flag for in the range [0..FRAMES-1].
Returns:
the frame error flag, true if errors were detected in the frame data or false if not. Error detection usually consists of checking frame synchronization data and bit parity.
Throws:
java.io.IOException - if an error occurred reading data from the stream.

getStream

public CHRPTStream getStream()
Description copied from interface: TelemetryDecoder
Gets the telemetry stream used for data.

Specified by:
getStream in interface TelemetryDecoder

getFrameSyncErrors

public int getFrameSyncErrors(int frame)
Gets the number of errors in the frame sync bits, or 0 if no errors are present. The number of errors is the total number of bits which differ between the expected frame sync bits and the actual frame sync bits.


getTime

public long getTime(int frame)
Gets the start time of frame capture in milliseconds since the epoch. This time may differ from the values returned by getDayCount(int) and getMillisecond(short[]) since some frames may have bit errors. The actual frame time is computed by examining a number of frame times, inferring the correct data start time from those times, and then computing the frame time using the frame index and the known frame step interval. This presents the CHRPT data as a continuous, uniformly stepping set of frames and is very useful for computing correct Earth locations for every sensor scan even when the frame itself contains unusable sensor data.

Specified by:
getTime in interface TelemetryDecoder
Parameters:
frame - the frame to return the time for, starting at 0.
Returns:
the frame start time in milliseconds since the epoch. The epoch in this case is January 1, 1970 00:00:00 UTC.

getSpacecraftId

public int getSpacecraftId()
Gets the spacecraft address identified for this CHRPT data. This may differ from the spacecraft address returned by getSpacecraftId(int) since some frames may have bit errors. The actual spacecraft address is detected by examining a number of CHRPT minor frames.

Returns:
the actual spacecraft address for this data.

getSpacecraftId

public int getSpacecraftId(int frame)
                    throws java.io.IOException
Gets the spacecraft address for the frame.

Throws:
java.io.IOException

getDayCount

public int getDayCount(int frame)
                throws java.io.IOException
Gets the frame day count.

Throws:
java.io.IOException

getMillisecond

public static int getMillisecond(short[] timeCode)
Gets the millisecond based on CHRPT time code data.

Parameters:
timeCode - the time code data as an array of four short values.
Returns:
the time in milliseconds from the time code data.

getMillisecond

public int getMillisecond(int frame)
                   throws java.io.IOException
Gets the frame millisecond.

Throws:
java.io.IOException

getAuxSyncErrors

public int getAuxSyncErrors(int frame)
Gets the number of errors in the frame auxiliary sync bits, or 0 if no errors are present. The number of errors is the total number of bits which differ between the expected auxiliary sync bits and the actual auxiliary sync bits.


getData

public InstrumentData getData(int frame,
                              Instrument inst)
                       throws java.io.IOException
Description copied from interface: TelemetryDecoder
Gets the frame data for a specific instrument.

Specified by:
getData in interface TelemetryDecoder
Parameters:
frame - the frame to return data for in the range [0..FRAMES-1].
inst - the instrument to return data for.
Returns:
the frame data for the specified instrument.
Throws:
java.io.IOException - if an error occurred reading the instrument data from the stream.

getSpacecraft

public Spacecraft getSpacecraft()
Description copied from interface: TelemetryDecoder
Gets the spacecraft detected by this decoder.

Specified by:
getSpacecraft in interface TelemetryDecoder

Terrenus HRPT v2.2