Acquisition
Class AcquisitionControl

java.lang.Object
  extended by PamController.PamControlledUnit
      extended by Acquisition.AcquisitionControl
All Implemented Interfaces:
OfflineDataStore, PamSettings

public class AcquisitionControl
extends PamControlledUnit
implements PamSettings, OfflineDataStore

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:
DaqSystem

Nested Class Summary
(package private)  class AcquisitionControl.acquisitionSettings
           
 
Field Summary
private  AcquisitionControl acquisitionControl
           
 AcquisitionParameters acquisitionParameters
           
private  AcquisitionProcess acquisitionProcess
           
private  int ARRAY_ERROR_NO_ARRAY
           
private  int ARRAY_ERROR_NO_ARRAYMANAGER
           
private  int ARRAY_ERROR_NOT_ENOUGH_HYDROPHONES
           
private  int ARRAY_ERROR_OK
           
private  DAQChannelListManager daqChannelListManager
           
protected  MenuItemEnabler daqMenuEnabler
           
private  FolderInputSystem folderSystem
           
private  DaqSystem lastSelSystem
           
private  javax.swing.JProgressBar levelBar
           
private  OfflineFileServer offlineFileServer
           
protected  PamController pamController
           
private  java.awt.Component statusBarComponent
           
private  javax.swing.JLabel statusBarText
           
protected  java.util.ArrayList<DaqSystem> systemList
           
private  javax.swing.JPanel systemPanel
           
static java.lang.String unitType
           
 
Fields inherited from class PamController.PamControlledUnit
isViewer
 
Constructor Summary
AcquisitionControl(java.lang.String name)
          Main control unit for audio data acquisition.
AcquisitionControl(java.lang.String name, boolean isSimulator)
           
 
Method Summary
private  int arrayChannelsOK()
           
 int ChannelsToHydrophones(int channels)
           
 boolean checkArrayChannels(java.awt.Frame parentFrame)
          Run a check to see that all read out channels are connected to a hydrophone and if not, do something about it.
 javax.swing.JMenuItem createDetectionMenu(java.awt.Frame parentFrame)
          Create a JMenu object containing MenuItems associated with PamProcesses
 void createOfflineDataMap(java.awt.Window parentFrame)
          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.
(package private)  void fillStatusBarText()
           
protected  boolean fillXMLParameters(org.w3c.dom.Document doc, org.w3c.dom.Element paramsEl)
          Add Module specific XML data.
 DaqSystem findDaqSystem(java.lang.String systemType)
          Finds a reference to a given DAQ system based on it's type (e.g.
 int findHydrophoneChannel(int hydrophoneId)
          finds the ADC channel for a given hydrophone.
 AcquisitionParameters getAcquisitionParameters()
          Getter for acquisition parameters.
 AcquisitionProcess getAcquisitionProcess()
           
(package private)  java.lang.String getArrayErrorMessage(int error)
           
 int getChannelHydrophone(int channel)
           
static java.util.ArrayList<AcquisitionControl> getControllers()
           
 DAQChannelListManager getDaqChannelListManager()
           
 AcquisitionProcess getDaqProcess()
           
 java.lang.String getDataSourceName()
          Get the data source name
 FolderInputSystem getFolderSystem()
           
 int[] getHydrophoneList()
          Return a list of which channels are connected to which hydrophones in the currentarray.
 OfflineFileServer getOfflineFileServer()
           
 double getPeak2PeakVoltage(int swChannel)
           
 java.io.Serializable getSettingsReference()
           
 long getSettingsVersion()
           
private  java.awt.Component getStatusBarComponent()
           
private  java.lang.String getStatusBarText()
          Prepares text for the status bar
 boolean loadData(PamDataBlock dataBlock, long dataStart, long dataEnd)
          Load data for a given datablock between two time limits.
 void notifyModelChanged(int changeType)
          General notification when the PAMGAURD model changes.
 void registerDaqSystem(DaqSystem daqSystem)
          Registered new DAQ systems and makes them available via the AcquisitionCialog
 boolean removeUnit()
           
 boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
           
 boolean saveData(PamDataBlock dataBlock)
          Save data previously loaded from the store during offline viewing.
 void setDaqProcess(AcquisitionProcess acquisitionProcess)
           
 void setHydrophoneList(int[] hydrophoneList)
          Sets the list of hydrophone numbers.
private  void setSelectedSystem()
           
 void setStatusBarLevel(double peakValue)
          Sets a level meter on the status bar
 void setupControlledUnit()
          called for all PamControlledUnits after all units have been created.
(package private)  void setupStatusBar()
           
 java.lang.String toString()
           
 
Methods inherited from class PamController.PamControlledUnit
addOtherRelatedMenuItems, addPamProcess, addRelatedMenuItems, canClose, createDisplayMenu, createFileMenu, createHelpMenu, fillXMLElement, getFrameNumber, getNumPamProcesses, getPamController, getPamModuleInfo, getPamProcess, getPamView, getSidePanel, getTabClipCopier, getTabPanel, getTabSpecificMenuBar, getUnitName, getUnitType, gotoTab, notifyArrayChanged, pamHasStopped, pamToStart, removePamProcess, rename, saveViewerData, setFrameNumber, setPamController, setPamModuleInfo, setPamView, setSidePanel, setTabPanel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface PamController.PamSettings
getUnitName, getUnitType
 

Field Detail

systemList

protected java.util.ArrayList<DaqSystem> systemList

acquisitionParameters

public AcquisitionParameters acquisitionParameters

acquisitionProcess

private AcquisitionProcess acquisitionProcess

daqMenuEnabler

protected MenuItemEnabler daqMenuEnabler

offlineFileServer

private OfflineFileServer offlineFileServer

statusBarText

private javax.swing.JLabel statusBarText

levelBar

private javax.swing.JProgressBar levelBar

unitType

public static final java.lang.String unitType
See Also:
Constant Field Values

acquisitionControl

private AcquisitionControl acquisitionControl

statusBarComponent

private java.awt.Component statusBarComponent

pamController

protected PamController pamController

daqChannelListManager

private DAQChannelListManager daqChannelListManager

folderSystem

private FolderInputSystem folderSystem

systemPanel

private javax.swing.JPanel systemPanel

lastSelSystem

private DaqSystem lastSelSystem

ARRAY_ERROR_OK

private final int ARRAY_ERROR_OK
See Also:
Constant Field Values

ARRAY_ERROR_NO_ARRAYMANAGER

private final int ARRAY_ERROR_NO_ARRAYMANAGER
See Also:
Constant Field Values

ARRAY_ERROR_NO_ARRAY

private final int ARRAY_ERROR_NO_ARRAY
See Also:
Constant Field Values

ARRAY_ERROR_NOT_ENOUGH_HYDROPHONES

private final int ARRAY_ERROR_NOT_ENOUGH_HYDROPHONES
See Also:
Constant Field Values
Constructor Detail

AcquisitionControl

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

It is possible to instantiate several instances of this, preferebly with different names to simultaneously aquire 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 apear 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:
DaqSystem

AcquisitionControl

public AcquisitionControl(java.lang.String name,
                          boolean isSimulator)
Method Detail

getStatusBarComponent

private java.awt.Component getStatusBarComponent()

registerDaqSystem

public void registerDaqSystem(DaqSystem daqSystem)
Registered new DAQ systems and makes them available via the AcquisitionCialog

Parameters:
daqSystem -

getControllers

public static java.util.ArrayList<AcquisitionControl> getControllers()

getDaqProcess

public AcquisitionProcess getDaqProcess()

setDaqProcess

public void setDaqProcess(AcquisitionProcess acquisitionProcess)

findDaqSystem

public DaqSystem findDaqSystem(java.lang.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 javax.swing.JMenuItem createDetectionMenu(java.awt.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

private void setSelectedSystem()

checkArrayChannels

public boolean checkArrayChannels(java.awt.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.

arrayChannelsOK

private int arrayChannelsOK()

getArrayErrorMessage

java.lang.String getArrayErrorMessage(int error)

fillStatusBarText

void fillStatusBarText()

toString

public java.lang.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

setupStatusBar

void setupStatusBar()

getStatusBarText

private java.lang.String getStatusBarText()
Prepares text for the status bar

Returns:
text in the status bar

getSettingsReference

public java.io.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()
Overrides:
removeUnit in class PamControlledUnit

getAcquisitionParameters

public AcquisitionParameters getAcquisitionParameters()
Getter for acquisition parameters.

Returns:
data acquisition parameters.

getAcquisitionProcess

public AcquisitionProcess getAcquisitionProcess()

getDaqChannelListManager

public DAQChannelListManager getDaqChannelListManager()

getOfflineFileServer

public OfflineFileServer getOfflineFileServer()
Returns:
the offlineFileServer

fillXMLParameters

protected boolean fillXMLParameters(org.w3c.dom.Document doc,
                                    org.w3c.dom.Element paramsEl)
Description copied from class: PamControlledUnit
Add Module specific XML data.

this will generally be the place where most modules set their xml settings data.

Overrides:
fillXMLParameters in class PamControlledUnit
Returns:

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()
Returns:
the folderSystem

createOfflineDataMap

public void createOfflineDataMap(java.awt.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 java.lang.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,
                        long dataStart,
                        long dataEnd)
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
dataStart - start time in milliseconds
dataEnd - end time in milliseconds
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.