|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nasa.gsfc.drl.rtstps.core.RtStpsNode
gov.nasa.gsfc.drl.rtstps.core.FrameSenderNode
gov.nasa.gsfc.drl.rtstps.core.fs.FrameSynchronizer
public class FrameSynchronizer
This class produces frames from buffers of bits, which it gives to a
FrameReceiver object. It does not do CRC checking, frame inversion, or any
other frame level processing. A FrameSynchronizer object is reuseable. To
use, you must give it a FrameReceiver object to handle its frame output,
and you must give it an setup object for configuration via the load method.
You give data to it with repeated calls to putBuffer
. You
should call shutdown
at the session's conclusion to eliminate
any partial frame.
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 Buffer |
crossover
I use the crossover buffer to hold a small fragment of the end of one buffer and the beginning of the next buffer. |
private TextStatusItem |
currentMode
|
private LongStatusItem |
dropToSearches
|
private static int |
FIRST_SEARCH
This is search mode at the very beginning of a pass for the first buffer. |
private static int |
FLYWHEEL
The FS is flywheeling. |
private static int |
FLYWHEEL_SPLIT_SYNC
This is a special split-sync scenario. |
private static java.lang.String |
FLYWHEEL_STATUS
|
private Flywheeler |
flywheeler
This class handles all flywheeling. |
private FrameClock |
frameClock
This class is the annotation timestamp clock. |
private Frames |
frameList
This is where the FrameSynchronizer collects frames from a single buffer. |
private AbstractSynchronizer |
invertedSync
This object handles inverted sync detection. |
private boolean |
isSlipped
The current sync pattern is slipped. |
private boolean |
isTrueSync
The current sync pattern is true, not inverted. |
(package private) static int |
LOCK
An internal state only. |
private static int |
LOCK_SPLIT_FRAME
Locked to sync. |
private static java.lang.String |
LOCK_STATUS
|
private static int |
LOST_SYNC
An internal state only. |
private static int |
SEARCH
The following parameters are FrameSynchronizer states. |
private static java.lang.String |
SEARCH_STATUS
|
private IntegerStatusItem |
searchBuffers
The number of buffers searched without finding lock. |
private FsSetup |
setup
The configuration for the current pass. |
private static int |
SPLIT_SYNC
The FS expects the sync pattern to be split across two buffers. |
private int |
state
The current FrameSynchronizer state. |
private LongStatusItem |
totalFrames
The FrameSynchronizer saves status information here. |
private AbstractSynchronizer |
trueSync
This object handles true sync detection. |
private Buffer |
workBuffer
I use a Buffer object to hold an input buffer. |
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 | |
---|---|
FrameSynchronizer()
Create a Frame Synchronizer node. |
Method Summary | |
---|---|
private void |
doFirstSearchScenario(Buffer buffer)
The FS begins this buffer in a search state. |
private void |
doFlywheelScenario(Buffer buffer)
The FS begins this buffer in a flywheel state. |
private void |
doLockScenario(Buffer buffer)
In lock. |
private int |
doLostSync(Buffer buffer)
The FrameSynchronizer has lost sync. |
private int |
doSearch(Buffer buffer)
Search the buffer for a sync pattern beginning at its current index. |
private void |
doSearchScenario(Buffer buffer)
The FS begins this buffer in a search state. |
private void |
doSplitSyncScenario(Buffer buffer)
The FS begins this buffer looking for the second fragment of a sync pattern. |
private Location |
findSyncPattern(Buffer buffer)
Find the first occurrence of a sync pattern in the buffer beginning at its current index but ending within X bytes of the buffer end. |
void |
flush()
Flush the pipeline. |
int |
getFrameLength()
Get the frame length. |
int |
getSyncPatternLength()
Get the sync pattern length in bytes. |
void |
load(org.w3c.dom.Element element,
Configuration configuration)
Load the FrameSynchronizer with a configuration. |
void |
putBuffer(byte[] data,
int dataLength)
Give a buffer of bits to the FrameSynchronizer. |
void |
shutdown()
End a session. |
private int |
verifySync(Buffer buffer)
Verify there is sync at the current buffer index. |
Methods inherited from class gov.nasa.gsfc.drl.rtstps.core.FrameSenderNode |
---|
addReceiver, finishSetup, 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 |
Field Detail |
---|
public static final java.lang.String CLASSNAME
private static final int SEARCH
private static final int LOCK_SPLIT_FRAME
private static final int SPLIT_SYNC
private static final int FLYWHEEL
private static final int FLYWHEEL_SPLIT_SYNC
private static final int FIRST_SEARCH
static final int LOCK
private static final int LOST_SYNC
private int state
private AbstractSynchronizer trueSync
private AbstractSynchronizer invertedSync
private Buffer workBuffer
private Buffer crossover
private boolean isTrueSync
private boolean isSlipped
private Frames frameList
private FsSetup setup
private LongStatusItem totalFrames
private LongStatusItem dropToSearches
private TextStatusItem currentMode
private static final java.lang.String LOCK_STATUS
private static final java.lang.String FLYWHEEL_STATUS
private static final java.lang.String SEARCH_STATUS
private IntegerStatusItem searchBuffers
private Flywheeler flywheeler
private FrameClock frameClock
Constructor Detail |
---|
public FrameSynchronizer()
Method Detail |
---|
public void load(org.w3c.dom.Element element, Configuration configuration) throws RtStpsException
load
in class FrameSenderNode
RtStpsException
public final int getFrameLength()
public final int getSyncPatternLength()
public void shutdown() throws RtStpsException
RtStpsException
public void flush() throws RtStpsException
flush
in class FrameSenderNode
RtStpsException
public void putBuffer(byte[] data, int dataLength) throws RtStpsException
When the FrameSynchronizer is in search mode, then the buffer size must be at least as large as twice the sync pattern length (i.e. at least 8 bytes for a 4-byte pattern). The searcher cannot reliably find sync if the buffer is smaller than the minimum. This limitation does not hold when it is in any other mode.
RtStpsException
private void doFirstSearchScenario(Buffer buffer)
The buffer size (remaining bytes) must be at least as large as twice the sync pattern length (i.e. at least 8 bytes for a 4-byte pattern). The searcher cannot reliably find sync if buffers are smaller than the minimum. If you pass a too-small buffer, the searcher will simply return still in search mode.
private void doSearchScenario(Buffer buffer)
The buffer size (remaining bytes) must be at least as large as twice the sync pattern length (i.e. at least 8 bytes for a 4-byte pattern). The searcher cannot reliably find sync if buffers are smaller than the minimum. If you pass a too-small buffer, the searcher will simply return still in search mode.
private void doFlywheelScenario(Buffer buffer)
private void doSplitSyncScenario(Buffer buffer)
private void doLockScenario(Buffer buffer)
private int doLostSync(Buffer buffer)
buffer
- The input buffer. Its length must be greater or equal
to the sync pattern length. If not, it remains in search.
private int doSearch(Buffer buffer)
private Location findSyncPattern(Buffer buffer)
private int verifySync(Buffer buffer)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |