public class TLcdASDILiveDecoder extends ALcdASDIDecoder
TLcdModelList
with it.
Depending on the type of messages in the ASDI feed different ILcdModel
objects are added to the TLcdModelList
. All ILcdModel
objects have an ILcdModelDescriptor
that is an
ALcdASDIModelDescriptor
. The method ALcdASDIModelDescriptor.getDataType()
allows to distinct between the different models.
Following table gives an overview of the different models in the TLcdModelList
,
specifying for each a description, the messages taken into account,
the domain objects in the model and the value returned from
ALcdASDIModelDescriptor.getDataType()
:
Model description | ASDI messages | Domain objects | ALcdASDIModelDescriptor.getDataType() |
---|---|---|---|
TZ tracks | TZ | TLcdASDITrack |
DATA_TYPE_TZ_TRACK |
TO tracks | TO | TLcdASDITrack |
DATA_TYPE_TO_TRACK |
Flight plan data | FZ, AF, DZ, UZ, AZ, RZ and RT | TLcdASDIFlightPlan |
DATA_TYPE_FLIGHT_PLAN |
The amount of points kept for the TLcdASDITrajectory
objects associated
with each TLcdASDITrack
can be limited with
the setHistoryLength(int)
.
Users of the live decoder that read the data in the TLcdModelList
,
for instance for displaying it on a map, must be sure the data is consistent when using it.
This requires some synchronization.
Therefore, whenever the decoder adds a sub model to the
given TLcdModelList
, it takes a write lock on the TLcdModelList
(see com.luciad.util.concurrent.TLcdLockUtil
).
Whenever it makes a modification to one of the elements of a sub model, it takes
a write lock on the sub model. Users of the live decoder can and should then take the
appropriate read locks to avoid synchronization problems.
The decoder can also be used to replay recorded ASDI data. The input stream given to the
decodeSFCT
method should be a TLcdASDIFileReplayInputStream
to achieve this.
TLcdLockUtil
Constructor and Description |
---|
TLcdASDILiveDecoder()
Creates a
TLcdASDILiveDecoder , a decoder for decoding live ASDI data. |
Modifier and Type | Method and Description |
---|---|
void |
decodeSFCT(InputStream aStream,
int aFireEventMode,
TLcdModelList aModelSFCT)
Modifies an existing
TLcdModelList to contain new
ASDI data read from the given InputStream . |
int |
getHistoryLength()
Returns the history length.
|
void |
setHistoryLength(int aHistoryLength)
Sets the history length to the given length.
|
getMessageFilter, getStartTime, setMessageFilter, setStartTime
public TLcdASDILiveDecoder()
TLcdASDILiveDecoder
, a decoder for decoding live ASDI data.public void setHistoryLength(int aHistoryLength)
TLcdASDITrajectory
objects associated with each TLcdASDITrack
to the given length.aHistoryLength
- The maximum amount of points that are kept in the history,
1 <= aHistoryLength,
is Integer.MAX_VALUE
by default meaning all points are kept.public int getHistoryLength()
setHistoryLength(int)
for details.public void decodeSFCT(InputStream aStream, int aFireEventMode, TLcdModelList aModelSFCT) throws IOException
TLcdModelList
to contain new
ASDI data read from the given InputStream
.
This method does not return until all data is
read. It is therefore advised to call it from a dedicated thread.
To stop the decoding process, use Thread.interrupt()
.aStream
- The stream to read an ASDI message from.aFireEventMode
- One of ILcdFireEventMode.FIRE_NOW
,
ILcdFireEventMode.FIRE_LATER
or
ILcdFireEventMode.NO_EVENT
. It allows to specify when and if any model events need to
be fired when the model is changed by this decoder. If FIRE_NOW
is used, changes
are immediately propagated, and the user of this method does not need to do anything else. If
for example FIRE_LATER
is used, the events are collected. It is than up the
the user of this method to fire those collected changes once in a while using
ILcdModel.fireCollectedModelChanges()
on aModelSFCT
.aModelSFCT
- The model to modify.IOException
- In case of IO failure.