Package Acquisition

Class AcquisitionControl

All Implemented Interfaces:
DataInputStore, OfflineDataStore, OfflineFileDataStore, PamSettings, SettingsNameProvider
Direct Known Subclasses:
STAcquisitionControl

public class AcquisitionControl extends RawInputControlledUnit implements PamSettings, OfflineFileDataStore, DataInputStore
Main data acquisition control to get audio data from sound cards, NI cards (via UDP), files, directories of files, etc.

Uses a plug in architecture to allow new types to be added. This is done through RegisterDaqType().

Author:
Doug Gillespie
See Also:
  • Field Details

  • Constructor Details

    • AcquisitionControl

      public AcquisitionControl(String name)
      Main control unit for audio data acquisition.

      It is possible to instantiate several instances of this, preferably with different names to simultaneously acquire sound from a number of sources such as multiple sound cards, fast ADC boards, etc.

      Each different acquisition device must implement the DaqSystem interface and register with each AcquisitionControl.

      Parameters:
      name - name of the Acquisition control that will appear in menus. These should be different for each instance of AcquistionControl since the names are used by PamProcesses to find the correct data blocks.
      See Also:
    • AcquisitionControl

      public AcquisitionControl(String name, boolean isSimulator)
    • AcquisitionControl

      public AcquisitionControl(String type, String name)
      Overloaded constructor - used by the STAcquisitionControl class as a way to call the PamController.PamControlledUnit constructor without all of the AcquisitionControl code above
      Parameters:
      type - the type of unit
      name - the name of the unit
  • Method Details

    • registerDaqSystem

      public void registerDaqSystem(DaqSystem daqSystem)
      Registered new DAQ systems and makes them available via the AcquisitionCialog
      Parameters:
      daqSystem -
    • getControllers

      public static ArrayList<AcquisitionControl> getControllers()
    • getDataLocation

      public String getDataLocation()
      Description copied from interface: OfflineDataStore
      Get the data location. This may be a specific file, or might be a folder if data are in many files, a URI, etc.
      Specified by:
      getDataLocation in interface OfflineDataStore
      Returns:
      store locations
    • getDaqProcess

      public AcquisitionProcess getDaqProcess()
    • setDaqProcess

      public void setDaqProcess(AcquisitionProcess acquisitionProcess)
    • findDaqSystem

      public DaqSystem findDaqSystem(String systemType)
      Finds a reference to a given DAQ system based on it's type (e.g. sound card, file, etc.
      Parameters:
      systemType -
      Returns:
      reference to a DaqSystem object
    • createDetectionMenu

      public JMenuItem createDetectionMenu(Frame parentFrame)
      Description copied from class: PamControlledUnit
      Create a JMenu object containing MenuItems associated with PamProcesses
      Overrides:
      createDetectionMenu in class PamControlledUnit
      Parameters:
      parentFrame - The owner frame of the menu
      Returns:
      reference to a JMenu which can be added to an existing menu or menu bar

      Note that if multiple views are to use the same menu, then they should each create a new menu (by setting Create to true) the first time they call this method.

    • setSelectedSystem

      public void setSelectedSystem()
    • checkArrayChannels

      public boolean checkArrayChannels()
      Check array channels have corresponding hydrophones in the array manager. Does not open a dialog to warn or fix.
      Returns:
      check array channel. False if array manager
    • checkArrayChannels

      public boolean checkArrayChannels(Frame parentFrame)
      Run a check to see that all read out channels are connected to a hydrophone and if not, do something about it.
      Returns:
      true if OK, or problem resolved.
    • toString

      public String toString()
      Overrides:
      toString in class PamControlledUnit
    • setStatusBarLevel

      public void setStatusBarLevel(double peakValue)
      Sets a level meter on the status bar
      Parameters:
      peakValue - Maximum amplitude fom AcquisitionProcess
    • getSettingsReference

      public Serializable getSettingsReference()
      Specified by:
      getSettingsReference in interface PamSettings
      Returns:
      The serialisable object that will be stored
    • getSettingsVersion

      public long getSettingsVersion()
      Specified by:
      getSettingsVersion in interface PamSettings
      Returns:
      An integer version number for the settings
    • restoreSettings

      public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
      Specified by:
      restoreSettings in interface PamSettings
      Returns:
      true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required
    • setupControlledUnit

      public void setupControlledUnit()
      Description copied from class: PamControlledUnit
      called for all PamControlledUnits after all units have been created. This is a good time for the controlled units and processes to find and check their source data and the configuration generally since most onjects (i.e. output data blocks) should be in place
      Overrides:
      setupControlledUnit in class PamControlledUnit
    • ChannelsToHydrophones

      public int ChannelsToHydrophones(int channels)
    • getHydrophoneList

      public int[] getHydrophoneList()
      Return a list of which channels are connected to which hydrophones in the currentarray.
      Returns:
      List of hydrophone numbers.
    • setHydrophoneList

      public void setHydrophoneList(int[] hydrophoneList)
      Sets the list of hydrophone numbers.
      Parameters:
      hydrophoneList - List of hydrophone numbers in channel order
    • findHydrophoneChannel

      public int findHydrophoneChannel(int hydrophoneId)
      finds the ADC channel for a given hydrophone. Will return -1 if no ADC channel uses this hydrophone
      Parameters:
      hydrophoneId - Number of a hydrophone in a PamArray
      Returns:
      the ADC channel for the given hydrophone
    • getChannelHydrophone

      public int getChannelHydrophone(int channel)
    • getPeak2PeakVoltage

      public double getPeak2PeakVoltage(int swChannel)
    • removeUnit

      public boolean removeUnit()
      Description copied from class: PamControlledUnit
      Called to remove a unit.
      Overrides:
      removeUnit in class PamControlledUnit
      Returns:
      try (not used)
    • getAcquisitionParameters

      public AcquisitionParameters getAcquisitionParameters()
      Getter for acquisition parameters.
      Returns:
      data acquisition parameters.
    • getAcquisitionProcess

      public AcquisitionProcess getAcquisitionProcess()
    • getDaqChannelListManager

      public DAQChannelListManager getDaqChannelListManager()
    • getOfflineFileServer

      public OfflineFileServer getOfflineFileServer()
      Specified by:
      getOfflineFileServer in interface OfflineFileDataStore
      Returns:
      the offlineFileServer
    • notifyModelChanged

      public void notifyModelChanged(int changeType)
      Description copied from class: PamControlledUnit
      General notification when the PAMGAURD model changes.
      Overrides:
      notifyModelChanged in class PamControlledUnit
      Parameters:
      changeType - type of change
    • getFolderSystem

      public FolderInputSystem getFolderSystem()
    • createOfflineDataMap

      public void createOfflineDataMap(Window parentFrame)
      Description copied from interface: OfflineDataStore
      Create a basic map of the data including first and last times and some kind of data/unit time count plus ideally some kind of start and stop time list of where there are gaps in the data.
      Specified by:
      createOfflineDataMap in interface OfflineDataStore
    • getDataSourceName

      public String getDataSourceName()
      Description copied from interface: OfflineDataStore
      Get the data source name
      Specified by:
      getDataSourceName in interface OfflineDataStore
      Returns:
      data source name
    • loadData

      public boolean loadData(PamDataBlock dataBlock, OfflineDataLoadInfo offlineLoadDataInfo, ViewLoadObserver loadObserver)
      Description copied from interface: OfflineDataStore
      Load data for a given datablock between two time limits.
      Specified by:
      loadData in interface OfflineDataStore
      Parameters:
      dataBlock - datablock owner of the data
      Returns:
      true if load successful.
    • saveData

      public boolean saveData(PamDataBlock dataBlock)
      Description copied from interface: OfflineDataStore
      Save data previously loaded from the store during offline viewing.
      Specified by:
      saveData in interface OfflineDataStore
      Parameters:
      dataBlock - datablock owner of the data
      Returns:
      true if saved or save not needed. False if an error prevents saving.
    • getRawDataBlock

      public PamRawDataBlock getRawDataBlock()
      Specified by:
      getRawDataBlock in interface OfflineFileDataStore
    • getParentProcess

      public PamProcess getParentProcess()
      Specified by:
      getParentProcess in interface OfflineFileDataStore
    • isStalled

      public boolean isStalled()
    • rewriteIndexFile

      public boolean rewriteIndexFile(PamDataBlock dataBlock, OfflineDataMapPoint dmp)
      Description copied from interface: OfflineDataStore
      Moved this function over from binary data store. Many storage systems may not be able to do this, but some might !
      Specified by:
      rewriteIndexFile in interface OfflineDataStore
      Returns:
    • getDatagramManager

      public DatagramManager getDatagramManager()
      Specified by:
      getDatagramManager in interface OfflineDataStore
      Returns:
      the datagramManager
    • getFileDate

      public FileDate getFileDate()
    • loadExternalDaqSystems

      public void loadExternalDaqSystems()
      Load any classes that were found in the plugins folder and implement the DaqSystemInterface interface
    • getSystemList

      public ArrayList<DaqSystem> getSystemList()
      Get the available DAQ systems
      Returns:
    • setAquisitionParams

      public void setAquisitionParams(AcquisitionParameters params)
      Set the acquisition parameters.
      Parameters:
      params - - the acquisition params to set.
    • getGUI

      public PamControlledUnitGUI getGUI(int flag)
      Description copied from class: PamControlledUnit
      Get the GUI for the PAMControlled unit. This has multiple GUI options which are instantiated depending on the view type.
      Overrides:
      getGUI in class PamControlledUnit
      Parameters:
      flag - . The GUI type flag defined in PAMGuiManager.
      Returns:
      the GUI for the PamControlledUnit unit.
    • getDaqSummary

      public String getDaqSummary()
      Get a summary of the daq settings for the QA module.
      Returns:
      summary of DAQ settings.
    • tellModule

      public String tellModule(String command)
      Description copied from class: PamControlledUnit
      Handle a module specific command sent by the tellmodule command.
      Overrides:
      tellModule in class PamControlledUnit
      Parameters:
      command - command line (stripped of the command and the module type and name)
      Returns:
      response to command
    • pamHasStopped

      public void pamHasStopped()
      Description copied from class: PamControlledUnit
      Called for all controlled units after Pam acquisition has stopped
      Overrides:
      pamHasStopped in class PamControlledUnit
    • getModuleSummary

      public String getModuleSummary(boolean clear)
      Description copied from class: PamControlledUnit
      Get a module summary text string for shorthand output to anyting wanting a short summary of data state / numbers of detections.
      Overrides:
      getModuleSummary in class PamControlledUnit
      Parameters:
      clear - clear data after generating string, so that counts of detections, etc. start again from 0.
      Returns:
      module summary string - goings on since the last call to this function
    • getSUDNotificationManager

      public SUDNotificationManager getSUDNotificationManager()
      Get the SUD processing notification manager.
      Returns:
      SUD processing notification manager.
    • getRawInputType

      public int getRawInputType()
      Description copied from class: RawInputControlledUnit
      Type of data input, which can be one of RAW_INPUT_UNKNOWN (0), RAW_INPUT_FILEARCHIVE (1), or RAW_INPUT_REALTIME (2)
      Specified by:
      getRawInputType in class RawInputControlledUnit
      Returns:
    • getStoreInfo

      public InputStoreInfo getStoreInfo(boolean detail)
      Description copied from interface: DataInputStore
      Get information about the input store (e.g. start times of all files).
      Specified by:
      getStoreInfo in interface DataInputStore
      Returns:
      information about data input.
    • setAnalysisStartTime

      public boolean setAnalysisStartTime(long startTime)
      Description copied from interface: DataInputStore
      Set an analysis start time. This might get called just before processing starts, in which case
      Specified by:
      setAnalysisStartTime in interface DataInputStore
      Returns:
      ok if no problems.
    • getBatchStatus

      public String getBatchStatus()
      Very specific command handler for batch status which will only work with the folderinputSystem.
      Specified by:
      getBatchStatus in interface DataInputStore
      Returns: