gov.nasa.gsfc.drl.rtstps.core.xstps.pds
Class PacketKernel

java.lang.Object
  extended by gov.nasa.gsfc.drl.rtstps.core.xstps.pds.PacketKernel

final class PacketKernel
extends java.lang.Object

This class contains fragments of packet information that Sorcerer needs.


Field Summary
private  long eshTime
          This is the Terra ESH time, which comes from the frame annotation.
private  boolean isCUC
          If true, the packet time is in CUC format.
private  long packetTime
          The packet time comes from the packet secondary header.
 
Constructor Summary
PacketKernel()
           
 
Method Summary
(package private)  int comparePacketTime(PacketKernel pk)
          Compare the packet times from two PacketKernel objects.
(package private)  void copy(PacketKernel pk)
          Copy a packet kernel into this object.
static long cucToDaySegmented(long cuc)
          Convert unsegmented time to day segmented format.
(package private)  long getEshTime()
          Get the ESH time.
(package private)  long getPacketTime()
          Get the packet time.
(package private)  boolean isEmpty()
          Does this packet kernel contain a packet?
private  long makeEshTime(long msFromEpoch)
          Make an ESH-format longword.
private  long makePacketTime(byte[] data, int start)
          Make a packet time longword.
(package private)  void set(Packet packet, boolean isCUC, int timeOffset)
          Load this object with a different packet.
 java.lang.String toString()
          Location of time in packet secondary header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

eshTime

private long eshTime
This is the Terra ESH time, which comes from the frame annotation. The format is PB5:
   8 bits      zero. my fill to extend it to 64 bits.
   1 bit       1
   14 bits     truncated julian day (0-9999) epoch: 8-10-95.
   17 bits     seconds of day (0-86,399)
   10 bits     milliseconds of second (0-999)
   10 bits     micro of milli (0-999)
   4 bits      zero.
 


packetTime

private long packetTime
The packet time comes from the packet secondary header. Some appids use an unsegmented format that I don't document here. The format for day-segmented packets is:
    Uint16 day since 1/1/1958
    Uint32 millisecond of day
    Uint16 microsecond of millisecond
 
The secondary header may have a 9th byte. If it exists, it either precedes the timecode or follows it.
    Byte   flags (0x80 = quicklook on)
 


isCUC

private boolean isCUC
If true, the packet time is in CUC format.

Constructor Detail

PacketKernel

PacketKernel()
Method Detail

toString

public java.lang.String toString()
Location of time in packet secondary header. It is a byte offset from the start of the packet. It is usually 6 or 7.

Overrides:
toString in class java.lang.Object

set

void set(Packet packet,
         boolean isCUC,
         int timeOffset)
Load this object with a different packet.

Parameters:
packet - the packet
isCUC - if true, this packet is an Aqua one that has unsegmented time in the secondary header. If false, it is one that has day segmented time in the secondary header.
timeOffset - offset in bytes to timecode from start of packet.

copy

void copy(PacketKernel pk)
Copy a packet kernel into this object.


isEmpty

final boolean isEmpty()
Does this packet kernel contain a packet?


getEshTime

final long getEshTime()
Get the ESH time.


getPacketTime

long getPacketTime()
Get the packet time.


comparePacketTime

final int comparePacketTime(PacketKernel pk)
Compare the packet times from two PacketKernel objects.

Returns:
Zero if they are equal, a positive value if this time is greater than the passed object's time, and a negative value otherwise.

makeEshTime

private long makeEshTime(long msFromEpoch)
Make an ESH-format longword.

Parameters:
msFromEpoch - Milliseconds from epoch.

makePacketTime

private long makePacketTime(byte[] data,
                            int start)
Make a packet time longword.

Parameters:
data - The packet data
start - Array index, where the time is

cucToDaySegmented

public static long cucToDaySegmented(long cuc)
Convert unsegmented time to day segmented format.
 aqua s/c bus tlm pkt format
      epoch=1/1/58
      16 bits pfield (I zero this)
      32 bits coarse time, seconds since epoch
      16 bits fine time, subseconds, 15.2 microseconds (1 mil micro / ffff)
                                      15.2587890625 micro per tick.

      terra day segmented format (epoch = 1/1/58)
      16 bits day
      32 bits ms of day
      16 bits micro of ms