Package Acquisition
Class AcquisitionControl
java.lang.Object
PamController.PamControlledUnit
PamController.RawInputControlledUnit
Acquisition.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 Summary
Fields inherited from class PamController.RawInputControlledUnit
RAW_INPUT_FILEARCHIVE, RAW_INPUT_REALTIME, RAW_INPUT_UNKNOWN
-
Constructor Summary
ConstructorDescriptionAcquisitionControl
(String name) Main control unit for audio data acquisition.AcquisitionControl
(String name, boolean isSimulator) 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 -
Method Summary
Modifier and TypeMethodDescriptionint
ChannelsToHydrophones
(int channels) boolean
Check array channels have corresponding hydrophones in the array manager.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.createDetectionMenu
(Frame parentFrame) Create a JMenu object containing MenuItems associated with PamProcessesvoid
createOfflineDataMap
(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.findDaqSystem
(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.Getter for acquisition parameters.Very specific command handler for batch status which will only work with the folderinputSystem.int
getChannelHydrophone
(int channel) static ArrayList<AcquisitionControl>
Get a summary of the daq settings for the QA module.Get the data location.Get the data source namegetGUI
(int flag) Get the GUI for the PAMControlled unit.int[]
Return a list of which channels are connected to which hydrophones in the currentarray.getModuleSummary
(boolean clear) Get a module summary text string for shorthand output to anyting wanting a short summary of data state / numbers of detections.double
getPeak2PeakVoltage
(int swChannel) int
Type of data input, which can be one of RAW_INPUT_UNKNOWN (0), RAW_INPUT_FILEARCHIVE (1), or RAW_INPUT_REALTIME (2)long
getStoreInfo
(boolean detail) Get information about the input store (e.g.Get the SUD processing notification manager.Get the available DAQ systemsboolean
boolean
loadData
(PamDataBlock dataBlock, OfflineDataLoadInfo offlineLoadDataInfo, ViewLoadObserver loadObserver) Load data for a given datablock between two time limits.void
Load any classes that were found in the plugins folder and implement the DaqSystemInterface interfacevoid
notifyModelChanged
(int changeType) General notification when the PAMGAURD model changes.void
Called for all controlled units after Pam acquisition has stoppedvoid
registerDaqSystem
(DaqSystem daqSystem) Registered new DAQ systems and makes them available via the AcquisitionCialogboolean
Called to remove a unit.boolean
restoreSettings
(PamControlledUnitSettings pamControlledUnitSettings) boolean
rewriteIndexFile
(PamDataBlock dataBlock, OfflineDataMapPoint dmp) Moved this function over from binary data store.boolean
saveData
(PamDataBlock dataBlock) Save data previously loaded from the store during offline viewing.boolean
setAnalysisStartTime
(long startTime) Set an analysis start time.void
Set the acquisition parameters.void
setDaqProcess
(AcquisitionProcess acquisitionProcess) void
setHydrophoneList
(int[] hydrophoneList) Sets the list of hydrophone numbers.void
void
setStatusBarLevel
(double peakValue) Sets a level meter on the status barvoid
called for all PamControlledUnits after all units have been created.tellModule
(String command) Handle a module specific command sent by the tellmodule command.toString()
Methods inherited from class PamController.PamControlledUnit
addOfflineTaskGroup, addOtherRelatedMenuItems, addPamProcess, addPamProcess, addRelatedMenuItems, canClose, canPlayViewerSound, createDisplayMenu, createFileMenu, createHelpMenu, flushDataBlockBuffers, getBackupInformation, getFrameNumber, getGuiFrame, getInstanceIndex, getModuleStatus, getModuleStatusManager, getModuleSummary, getNumOfflineTaskGroups, getNumPamProcesses, getOfflineState, getOfflineTaskGroup, getPamConfiguration, getPamController, getPamModuleInfo, getPamProcess, getPamView, getPlugin, getShortUnitType, getSidePanel, getTabClipCopier, getTabPanel, getTabSpecificMenuBar, getToolbarComponent, getUnitName, getUnitType, getVerboseLevel, gotoTab, isInMainConfiguration, isNetRx, isViewer, pamClose, pamToStart, playViewerSound, removePamProcess, rename, saveViewerData, setFrameNumber, setModuleStatusManager, setPamConfiguration, setPamController, setPamModuleInfo, setPamView, setSidePanel, setTabPanel, setToolbarComponent, stopViewerSound, terminalPrint, terminalPrintln
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface PamController.OfflineFileDataStore
getUnitName
Methods inherited from interface PamController.PamSettings
getUnitType
Methods inherited from interface PamController.SettingsNameProvider
getUnitName
-
Field Details
-
acquisitionParameters
-
unitType
- See Also:
-
-
Constructor Details
-
AcquisitionControl
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
-
AcquisitionControl
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 unitname
- the name of the unit
-
-
Method Details
-
registerDaqSystem
Registered new DAQ systems and makes them available via the AcquisitionCialog- Parameters:
daqSystem
-
-
getControllers
-
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 interfaceOfflineDataStore
- Returns:
- store locations
-
getDaqProcess
-
setDaqProcess
-
findDaqSystem
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
Description copied from class:PamControlledUnit
Create a JMenu object containing MenuItems associated with PamProcesses- Overrides:
createDetectionMenu
in classPamControlledUnit
- 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
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
- Overrides:
toString
in classPamControlledUnit
-
setStatusBarLevel
public void setStatusBarLevel(double peakValue) Sets a level meter on the status bar- Parameters:
peakValue
- Maximum amplitude fom AcquisitionProcess
-
getSettingsReference
- Specified by:
getSettingsReference
in interfacePamSettings
- Returns:
- The serialisable object that will be stored
-
getSettingsVersion
public long getSettingsVersion()- Specified by:
getSettingsVersion
in interfacePamSettings
- Returns:
- An integer version number for the settings
-
restoreSettings
- Specified by:
restoreSettings
in interfacePamSettings
- 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 classPamControlledUnit
-
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 classPamControlledUnit
- Returns:
- try (not used)
-
getAcquisitionParameters
Getter for acquisition parameters.- Returns:
- data acquisition parameters.
-
getAcquisitionProcess
-
getDaqChannelListManager
-
getOfflineFileServer
- Specified by:
getOfflineFileServer
in interfaceOfflineFileDataStore
- Returns:
- the offlineFileServer
-
notifyModelChanged
public void notifyModelChanged(int changeType) Description copied from class:PamControlledUnit
General notification when the PAMGAURD model changes.- Overrides:
notifyModelChanged
in classPamControlledUnit
- Parameters:
changeType
- type of change
-
getFolderSystem
-
createOfflineDataMap
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 interfaceOfflineDataStore
-
getDataSourceName
Description copied from interface:OfflineDataStore
Get the data source name- Specified by:
getDataSourceName
in interfaceOfflineDataStore
- 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 interfaceOfflineDataStore
- Parameters:
dataBlock
- datablock owner of the data- Returns:
- true if load successful.
-
saveData
Description copied from interface:OfflineDataStore
Save data previously loaded from the store during offline viewing.- Specified by:
saveData
in interfaceOfflineDataStore
- Parameters:
dataBlock
- datablock owner of the data- Returns:
- true if saved or save not needed. False if an error prevents saving.
-
getRawDataBlock
- Specified by:
getRawDataBlock
in interfaceOfflineFileDataStore
-
getParentProcess
- Specified by:
getParentProcess
in interfaceOfflineFileDataStore
-
isStalled
public boolean isStalled() -
rewriteIndexFile
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 interfaceOfflineDataStore
- Returns:
-
getDatagramManager
- Specified by:
getDatagramManager
in interfaceOfflineDataStore
- Returns:
- the datagramManager
-
getFileDate
-
loadExternalDaqSystems
public void loadExternalDaqSystems()Load any classes that were found in the plugins folder and implement the DaqSystemInterface interface -
getSystemList
Get the available DAQ systems- Returns:
-
setAquisitionParams
Set the acquisition parameters.- Parameters:
params
- - the acquisition params to set.
-
getGUI
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 classPamControlledUnit
- Parameters:
flag
- . The GUI type flag defined in PAMGuiManager.- Returns:
- the GUI for the PamControlledUnit unit.
-
getDaqSummary
Get a summary of the daq settings for the QA module.- Returns:
- summary of DAQ settings.
-
tellModule
Description copied from class:PamControlledUnit
Handle a module specific command sent by the tellmodule command.- Overrides:
tellModule
in classPamControlledUnit
- 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 classPamControlledUnit
-
getModuleSummary
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 classPamControlledUnit
- 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
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 classRawInputControlledUnit
- Returns:
-
getStoreInfo
Description copied from interface:DataInputStore
Get information about the input store (e.g. start times of all files).- Specified by:
getStoreInfo
in interfaceDataInputStore
- 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 interfaceDataInputStore
- Returns:
- ok if no problems.
-
getBatchStatus
Very specific command handler for batch status which will only work with the folderinputSystem.- Specified by:
getBatchStatus
in interfaceDataInputStore
- Returns:
-