Package AIS

Class AISDataBlock

All Implemented Interfaces:
NMEAEmulator

public class AISDataBlock extends PamDataBlock<AISDataUnit> implements NMEAEmulator
  • Constructor Details

  • Method Details

    • addAISData

      public boolean addAISData(AISDataUnit newAISUnit)
      aisDataUnit is always a new unit extracted from a group of AIS strings, but with a single lot of data. Depending on what type of data it was, it will contain either static or position data. If the transponder has already sent data, then update it. Otherwise, create a new unit.

      Whether or not we actually want this data is a complicated question.

      If there is no limitation to range, we want it.

      If range is limited and the new data is a position report we want it if it's in range.

      If it's static data and does not match an existing set of data we don't want it since we don't know if it's in range or not.

      If it's static data and matches existing data, then we want it.

      If a new unit is created, notifications are sent out automatically. otherwise, generate one to notify observers.

      Parameters:
      newAISUnit - new AIS data unit
      Returns:
      true if it's updating an old unit, false if it's a new one.
    • findAISDataUnit

      public AISDataUnit findAISDataUnit(int mmsiNumber)
      Find and AIS unit based on it's MMSI Number. Returns the PamDataUnit rather than the AISData since that's needed in a wee while.
      Parameters:
      mmsiNumber -
      Returns:
      An existing AIS dataunit with the same mmsi number
    • getNextData

      public EmulatedData getNextData()
      Specified by:
      getNextData in interface NMEAEmulator
      Returns:
      the next emulated data, or null if there are no more.
    • prepareDataSource

      public boolean prepareDataSource(long[] timeLimits, long timeOffset)
      Description copied from interface: NMEAEmulator
      Prepare the data to be read into the emulator.

      The task may be as simple as setting up an interator to go through the data already read into the datablock or it may involve setting up a new database query to get back to raw data.

      Specified by:
      prepareDataSource in interface NMEAEmulator
      Parameters:
      timeLimits - time limits for the emulation
      timeOffset - time offset - between when the data were collected and the time they should be emulated at.
      Returns:
      true if OK