Package com.luciad.format.asterix
Class TLcdASTERIXLiveDecoder
java.lang.Object
com.luciad.format.asterix.ALcdASTERIXDecoder
com.luciad.format.asterix.TLcdASTERIXLiveDecoder
- All Implemented Interfaces:
Closeable,AutoCloseable
This decoder reads ASTERIX data from a live stream, and updates a given
TLcdModelList with it.
For each encountered category/
UAP/datatype combination,
a new sub ILcdModel is added to the TLcdModelList. The datatype
can either be tracks, plots
or ILcdDataObject for radars or service messages.
The current implementation of TLcdASTERIXLiveDecoder will
add tracks, plots
or ILcdDataObject for radars or service messages to the sub models. The domain object depends on the
incoming messages. Messages without ID's will be generated as plots, other messages will be generated as tracks, radars or service messages.
Sub-models containing trajectory data will have a track model descriptor,
sub-models containing plots will have a plot model descriptor,
sub-models containing a radar will have a TLcdASTERIXRadarVideoModelDescriptor,
while sub-models containing service messages will have a TLcdASTERIXRadarServiceMessageModelDescriptor.
Whenever this decoder adds a sub model to the given TLcdModelList, it takes
a write lock on the TLcdModelList (see TLcdLockUtil).
Whenever it makes a modification to one of the elements of a sub model, it takes
a lock on the sub model. Users of the live decoder should also take the
appropriate read (or write) locks to avoid threading problems.
This decoder can also be used to replay recorded ASTERIX data, provided it is in the
ASTERIX Final format or the
PCAP format. The input stream given to the
decodeSFCT(InputStream, int, ILcdModelContainer) decodeSFCT}
or initDecode
methods should be a TLcdASTERIXFinalReplayInputStream to achieve this. The format of the
stream needs to be explicitly specified to the replay stream if not ASTERIX final (e.g PCAP).
Supported versions
- The decoder supports the categories 1, 8, 10, 11, 21, 30, 34, 48, 62, 240 and 244 of the ASTERIX standard. See the Overview of the ASTERIX specifications for the supported categories for the full list of specifications used to implement the categories. For more information on the ASTERIX standard, see the EUROCONTROL website.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif the next ASTERIX block can be read without blocking on I/O.voidclose()Closes this live decoder, signalingdecodeBlockSFCT(int, com.luciad.model.ILcdModelContainer)will not be called anymore.voiddecodeBlockSFCT(int aFireEventMode, ILcdModelContainer aModelSFCT) Reads a single ASTERIX block from theInputStreamthat was given to initDecode(java.io.InputStream).voiddecodeSFCT(InputStream aStream, int aFireEventMode, ILcdModelContainer aModelSFCT) Modifies the givenILcdModelContainerto contain new blocks of ASTERIX data that are read from the givenInputStream.intReturns the history length.voidinitDecode(InputStream aInputStream) Prepares this decoder to read live ASTERIX data from the givenInputStream.voidsetHistoryLength(int aHistoryLength) Sets the history length to the given length.Methods inherited from class com.luciad.format.asterix.ALcdASTERIXDecoder
getCategories, getRecordFilter, getReferenceProvider, getScalingFactorProvider, getTransformationProvider, isClassTraceOn, setCategories, setClassTraceOn, setRecordFilter, setReferenceProvider, setScalingFactorProvider, setTransformationProvider
-
Constructor Details
-
TLcdASTERIXLiveDecoder
public TLcdASTERIXLiveDecoder()
-
-
Method Details
-
setHistoryLength
public void setHistoryLength(int aHistoryLength) Sets the history length to the given length. This will limit the amount of points in the history to the given length. For example, if the history length is set to five, theTLcdASTERIXTrajectorys preserve only the last five track locations.For some ASTERIX categories (e.g. Category 240) no history is kept, as such this parameter will have no effect.
- Parameters:
aHistoryLength- The maximum amount of points that are be kept in the history.
-
getHistoryLength
public int getHistoryLength()Returns the history length. Please refer tosetHistoryLength(int)for details.- Returns:
- the history length.
- See Also:
-
decodeSFCT
public void decodeSFCT(InputStream aStream, int aFireEventMode, ILcdModelContainer aModelSFCT) throws IOException Modifies the givenILcdModelContainerto contain new blocks of ASTERIX data that are read from the givenInputStream. For each data block, the applicable model in the model container is updated or created if it does not yet exists. This method does not return until all data is read. To stop the decoding process, useThread.interrupt(). Because this method does not return until all data is handled, it is advised to call it from a dedicated thread.- Parameters:
aStream- The stream to read data blocks from.aFireEventMode- One ofILcdFireEventMode.FIRE_NOW,ILcdFireEventMode.FIRE_LATERorILcdFireEventMode.NO_EVENT. It allows to specify when and if any model events need to be fired when the model container and its models are changed by this decoder. IfFIRE_NOWis used, changes are immediately propagated after each decoded data block, and the user of this method does not need to do anything else. IfFIRE_LATERis used, the events are collected. It is then up to the user of this method to fire those collected changes once in a while usingILcdModel.fireCollectedModelChanges()onaModelSFCT. IfNO_EVENTis used, no events are collected nor fired.aModelSFCT- The model to modify.- Throws:
IOException- In case of I/O failure.
-
initDecode
Prepares this decoder to read live ASTERIX data from the givenInputStream.This method may only be called once. If this method is called, you need to call
decodeBlockSFCTto decode the live data block by block. You should not use thedecodeSFCTmethod anymore after calling this method.If you are finished with the live decoder, you should call the
close()method.- Parameters:
aInputStream- TheInputStreamfrom whichdecodeBlockSFCTshould read the live data.- See Also:
-
decodeBlockSFCT
Reads a single ASTERIX block from theInputStreamthat was given to initDecode(java.io.InputStream).initDecodeshould have been called once before calling this method.- Parameters:
aFireEventMode- One ofILcdModel.FIRE_NOW,ILcdModel.FIRE_LATERorILcdModel.NO_EVENT. It allows to specify when and if any model events need to be fired when the model is changed by this decoder. IfFIRE_NOWis used, changes are immediately propagated, and the user of this method does not need to do anything else. If for exampleFIRE_LATERis used, the events are collected. It is than up the the user of this method to fire those collected changes once in a while usingILcdModel.fireCollectedModelChanges()onaModelSFCT.aModelSFCT- The model to modify.- Throws:
EOFException- when no more live data can be received.IOException- In case of I/O failure.- See Also:
-
blockAvailable
Returnstrueif the next ASTERIX block can be read without blocking on I/O. This method is useful when you don't want your UI thread (for instance, the AWT Event Dispatch Thread) to be blocked on theInputStream.- Returns:
trueif the next ASTERIX block can be read without blocking on I/O.falseotherwise.- Throws:
IOException- In case of an I/O exception.
-
close
Closes this live decoder, signalingdecodeBlockSFCT(int, com.luciad.model.ILcdModelContainer)will not be called anymore.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- If there is an I/O error while closing the live decoder.
-