Class TLcdASDILiveDecoder


public class TLcdASDILiveDecoder extends ALcdASDIDecoder
Reads data from a live ASDI feed and updates a given 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()
Flight plan data FZ, AF, DZ, UZ, AZ, RZ and RT TLcdASDIFlightPlan DATA_TYPE_FLIGHT_PLAN

The domain objects group messages that belong together.

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.

See Also:
  • Constructor Details

    • TLcdASDILiveDecoder

      public TLcdASDILiveDecoder()
      Creates a TLcdASDILiveDecoder, a decoder for decoding live ASDI data.
  • Method Details

    • setHistoryLength

      public void setHistoryLength(int aHistoryLength)
      Sets the history length to the given length. This will limit the amount of points kept for the 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.
    • getHistoryLength

      public int getHistoryLength()
      Returns the history length. Please refer to setHistoryLength(int) for details.
      the history length.
    • decodeSFCT

      public void decodeSFCT(InputStream aStream, int aFireEventMode, TLcdModelList aModelSFCT) throws IOException
      Modifies an existing 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.