implements NMEAEmula
@Override
public EmulatedData getNextData() {
SQLTypes sqlTypes = DBControlUnit.findConnection().getSqlTypes();
- if (getLogging().readNextEmulation(sqlTypes) == false) {
+ if (!getLogging().readNextEmulation(sqlTypes)) {
return null;
}
// now all data should be in the loggers table definition.
diff --git a/src/AIS/AISDataUnit.java b/src/AIS/AISDataUnit.java
index 74f6b56d..de915d96 100644
--- a/src/AIS/AISDataUnit.java
+++ b/src/AIS/AISDataUnit.java
@@ -5,7 +5,6 @@ import java.util.ArrayList;
import NMEA.NMEABitArray;
import NMEA.NMEADataBlock;
-import PamDetection.AbstractLocalisation;
import PamDetection.LocContents;
import PamUtils.PamCalendar;
import PamguardMVC.PamDataUnit;
diff --git a/src/AIS/AISGraphics.java b/src/AIS/AISGraphics.java
index da43a0f4..1f868d8d 100644
--- a/src/AIS/AISGraphics.java
+++ b/src/AIS/AISGraphics.java
@@ -7,8 +7,6 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
-import radardisplay.RadarProjector;
-
import GPS.GpsData;
import GPS.GpsDataUnit;
import Map.MapRectProjector;
@@ -20,14 +18,14 @@ import PamUtils.Coordinate3d;
import PamUtils.LatLong;
import PamUtils.PamCalendar;
import PamView.GeneralProjector;
+import PamView.GeneralProjector.ParameterType;
import PamView.PamDetectionOverlayGraphics;
import PamView.PamKeyItem;
import PamView.PamSymbol;
import PamView.PamSymbolType;
-import PamView.GeneralProjector.ParameterType;
import PamView.symbol.SymbolData;
import PamguardMVC.PamDataUnit;
-import PamguardMVC.debug.Debug;
+import radardisplay.RadarProjector;
public class AISGraphics extends PamDetectionOverlayGraphics {
@@ -73,12 +71,12 @@ public class AISGraphics extends PamDetectionOverlayGraphics {
AISStaticData staticData = aisDataUnit.getStaticData();
AISPositionReport positionReport = aisDataUnit.getPositionReport();
- if (aisDataUnit.isComplete() == false) {
+ if (!aisDataUnit.isComplete()) {
return null;
}
AbstractLocalisation localisation = pamDataUnit.getLocalisation();
- if (localisation == null || localisation.hasLocContent(LocContents.HAS_BEARING | LocContents.HAS_RANGE) == false) return null;
+ if (localisation == null || !localisation.hasLocContent(LocContents.HAS_BEARING | LocContents.HAS_RANGE)) return null;
double bearing = localisation.getBearing(0) * 180 / Math.PI;
double range = localisation.getRange(0);
Coordinate3d c3d = generalProjector.getCoord3d(bearing, range, 0);
diff --git a/src/AIS/AISLogger.java b/src/AIS/AISLogger.java
index 01b9c4d2..bf384431 100644
--- a/src/AIS/AISLogger.java
+++ b/src/AIS/AISLogger.java
@@ -1,22 +1,19 @@
package AIS;
-import generalDatabase.DBProcess;
-import generalDatabase.PamConnection;
-import generalDatabase.PamTableDefinition;
-import generalDatabase.PamTableItem;
-import generalDatabase.SQLLogging;
-import generalDatabase.SQLTypes;
-
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
-import javax.naming.ldap.HasControls;
-
import PamController.PamController;
import PamView.dialog.warn.WarnOnce;
import PamguardMVC.PamDataUnit;
+import generalDatabase.DBProcess;
+import generalDatabase.PamConnection;
+import generalDatabase.PamTableDefinition;
+import generalDatabase.PamTableItem;
+import generalDatabase.SQLLogging;
+import generalDatabase.SQLTypes;
public class AISLogger extends SQLLogging {
@@ -167,7 +164,7 @@ public class AISLogger extends SQLLogging {
acallSign = (String) callSign.getValue();
ashipName = (String) shipName.getValue();
ashipType = (String) shipType.getValue();
- aetaMillis = sqlTypes.millisFromTimeStamp(eta.getValue());
+ aetaMillis = SQLTypes.millisFromTimeStamp(eta.getValue());
// aetaMillis = (Long) eta.getValue();
adraught = (Double) draft.getValue();
adestination = (String) destination.getValue();
diff --git a/src/AIS/AISStaticData.java b/src/AIS/AISStaticData.java
index cbf891dc..af9b8889 100644
--- a/src/AIS/AISStaticData.java
+++ b/src/AIS/AISStaticData.java
@@ -199,7 +199,7 @@ public class AISStaticData extends AISReport implements Serializable, ManagedPar
}
switch(stationType) {
case BASESTATION:
- return stationType.BASESTATION.toString();
+ return StationType.BASESTATION.toString();
case A:
case B:
return getVesselTypeAndCargo(type);
diff --git a/src/AIS/AISStringsTable.java b/src/AIS/AISStringsTable.java
index 536cc5cc..2542e30f 100644
--- a/src/AIS/AISStringsTable.java
+++ b/src/AIS/AISStringsTable.java
@@ -109,12 +109,13 @@ public class AISStringsTable {
class TimerListener implements ActionListener {
boolean doneLayout;
+ @Override
public void actionPerformed(ActionEvent ev) {
// table.
// nmeaTableData.fireTableRowsUpdated(0, 10);
aisTableData.fireTableDataChanged();
- if (doneLayout == false && aisTableData.getRowCount() > 0) {
+ if (!doneLayout && aisTableData.getRowCount() > 0) {
doneLayout = true;
}
}
@@ -134,6 +135,7 @@ public class AISStringsTable {
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getColumnCount()
*/
+ @Override
public int getColumnCount() {
return tableColumns.length;
}
@@ -141,6 +143,7 @@ public class AISStringsTable {
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getRowCount()
*/
+ @Override
public int getRowCount() {
if (aisDataBlock == null) return 0;
//System.out.println(aisDataBlock.getUnitsCount() + " rows in AIS data");
@@ -150,6 +153,7 @@ public class AISStringsTable {
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getValueAt(int, int)
*/
+ @Override
public Object getValueAt(int rowIndex, int columnIndex) {
AISDataUnit aisDataUnit = aisDataBlock.getDataUnit(rowIndex, PamDataBlock.REFERENCE_CURRENT);
diff --git a/src/AIS/ProcessAISData.java b/src/AIS/ProcessAISData.java
index 717dc1db..4c4c73cc 100644
--- a/src/AIS/ProcessAISData.java
+++ b/src/AIS/ProcessAISData.java
@@ -3,7 +3,6 @@ package AIS;
import NMEA.NMEADataBlock;
import NMEA.NMEADataUnit;
import PamController.PamController;
-import PamDetection.AbstractLocalisation;
import PamDetection.LocContents;
import PamUtils.PamCalendar;
import PamView.symbol.StandardSymbolManager;
@@ -11,7 +10,6 @@ import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import PamguardMVC.PamObservable;
import PamguardMVC.PamProcess;
-import autecPhones.AutecGraphics;
/**
* Process NMEA data to extract AIS information
diff --git a/src/Acquisition/AcquisitionCParameters.java b/src/Acquisition/AcquisitionCParameters.java
index c50d23a0..2ccf4397 100644
--- a/src/Acquisition/AcquisitionCParameters.java
+++ b/src/Acquisition/AcquisitionCParameters.java
@@ -2,7 +2,7 @@ package Acquisition;
/**
* Very simplified version of the Acquisition parameters
- * to be passed over the JNI to the C backend.
+ * to be passed over the JNI to the C backend.
* @author Doug
*
*/
@@ -12,7 +12,7 @@ public class AcquisitionCParameters {
public static final int SOUNDCARD = 1;
public static final int WAVFILE = 2;
public static final int DAQCARD = 3;
-
+
public int deviceType;
public int deviceNumber;
public int sampleRate;
@@ -23,7 +23,7 @@ public class AcquisitionCParameters {
public String spareString2 = null;
public int[] channelList = new int[MAXCHAN];
public String soundFile;
-
+
public int setDaqType(String daqType) {
deviceType = -1;
if (daqType.equalsIgnoreCase("Sound Card")) {
@@ -37,5 +37,5 @@ public class AcquisitionCParameters {
}
return deviceType;
}
-
+
}
diff --git a/src/Acquisition/AcquisitionControl.java b/src/Acquisition/AcquisitionControl.java
index 952aabcd..63ef8903 100644
--- a/src/Acquisition/AcquisitionControl.java
+++ b/src/Acquisition/AcquisitionControl.java
@@ -1,19 +1,19 @@
/* PAMGUARD - Passive Acoustic Monitoring GUARDianship.
- * To assist in the Detection Classification and Localisation
+ * To assist in the Detection Classification and Localisation
* of marine mammals (cetaceans).
- *
- * Copyright (C) 2006
- *
+ *
+ * Copyright (C) 2006
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -21,10 +21,6 @@
package Acquisition;
-import hfDaqCard.SmruDaqSystem;
-//import mcc.mccacquisition.MCCDaqSystem;
-import mcc.mccacquisition.MCCDaqSystem;
-
import java.awt.Component;
import java.awt.Frame;
import java.awt.Window;
@@ -38,20 +34,6 @@ import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
-import org.pamguard.x3.sud.Chunk;
-import org.pamguard.x3.sud.SudFileListener;
-
-import dataGram.DatagramManager;
-import dataMap.OfflineDataMapPoint;
-import dataMap.filemaps.OfflineFileServer;
-import dataPlotsFX.data.TDDataProviderRegisterFX;
-import dataPlotsFX.rawDataPlotFX.RawSoundProviderFX;
-import pamScrollSystem.ViewLoadObserver;
-import simulatedAcquisition.SimProcess;
-//import xarraydaq.XArrayDaq;
-import asiojni.ASIOSoundSystem;
-import asiojni.NewAsioSoundSystem;
-import nidaqdev.NIDAQProcess;
import Acquisition.filedate.FileDate;
import Acquisition.filedate.StandardFileDate;
import Acquisition.filetypes.SoundFileTypes;
@@ -74,8 +56,6 @@ import PamController.PamGUIManager;
import PamController.PamSettingManager;
import PamController.PamSettings;
import PamController.RawInputControlledUnit;
-import PamController.fileprocessing.StoreStatus;
-import PamModel.PamModel;
import PamModel.SMRUEnable;
import PamUtils.FrequencyFormat;
import PamUtils.PamCalendar;
@@ -91,6 +71,20 @@ import PamguardMVC.PamDataBlock;
import PamguardMVC.PamProcess;
import PamguardMVC.PamRawDataBlock;
import PamguardMVC.dataOffline.OfflineDataLoadInfo;
+//import xarraydaq.XArrayDaq;
+import asiojni.ASIOSoundSystem;
+import asiojni.NewAsioSoundSystem;
+import dataGram.DatagramManager;
+import dataMap.OfflineDataMapPoint;
+import dataMap.filemaps.OfflineFileServer;
+import dataPlotsFX.data.TDDataProviderRegisterFX;
+import dataPlotsFX.rawDataPlotFX.RawSoundProviderFX;
+import hfDaqCard.SmruDaqSystem;
+//import mcc.mccacquisition.MCCDaqSystem;
+import mcc.mccacquisition.MCCDaqSystem;
+import nidaqdev.NIDAQProcess;
+import pamScrollSystem.ViewLoadObserver;
+import simulatedAcquisition.SimProcess;
/**
* Main data acquisition control to get audio data from sound cards,
@@ -98,9 +92,9 @@ import PamguardMVC.dataOffline.OfflineDataLoadInfo;
*
* Uses a plug in architecture to allow new types to be added. This
* is done through RegisterDaqType().
- *
+ *
* @author Doug Gillespie
- *
+ *
* @see Acquisition.DaqSystem
*
*/
@@ -133,26 +127,26 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
protected FolderInputSystem folderSystem;
private DCL5System dclSystem;
-
+
protected FileDate fileDate;
-
+
/**
- * The JavaFX GUI for the sound acquisition module.
+ * The JavaFX GUI for the sound acquisition module.
*/
private AquisitionGUIFX aquisitionGUIFX;
-
+
private SUDNotificationManager sudNotificationManager;
-
+
protected SoundFileTypes soundFileTypes;
-
+
/**
* 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.
+ * sources such as multiple sound cards, fast ADC boards, etc.
*
- * Each different acquisition device must implement the DaqSystem interface
+ * Each different acquisition device must implement the DaqSystem interface
* and register with each AcquisitionControl.
* @param 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
@@ -164,13 +158,13 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
super(unitType, name);
acquisitionControl = this;
-
+
fileDate = new StandardFileDate(this);
pamController = PamController.getInstance();
-
+
soundFileTypes = new SoundFileTypes(this);
-
+
registerDaqSystem(new SoundCardSystem(this));
if (PlatformInfo.calculateOS() == OSType.WINDOWS) {
long tic = System.currentTimeMillis();
@@ -178,13 +172,13 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
registerDaqSystem(new ASIOSoundSystem(this));
toc = System.currentTimeMillis();
if (toc-tic>1000) {
- System.out.printf("Registering ASIOSoundSystem took %3.1fs\n", (double)(toc-tic)/1000.);
+ System.out.printf("Registering ASIOSoundSystem took %3.1fs\n", (toc-tic)/1000.);
}
tic = System.currentTimeMillis();
registerDaqSystem(new NewAsioSoundSystem(this));
toc = System.currentTimeMillis();
if (toc-tic>1000) {
- System.out.printf("Registering NewAsioSoundSystem took %3.1fs\n", (double)(toc-tic)/1000.);
+ System.out.printf("Registering NewAsioSoundSystem took %3.1fs\n", (toc-tic)/1000.);
}
}
registerDaqSystem(new FileInputSystem(this));
@@ -200,7 +194,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
registerDaqSystem(new MCCDaqSystem(this));
// registerDaqSystem(new RonaInputSystem(this));
}
-
+
// load the DAQ Systems found in the plugins folder
loadExternalDaqSystems();
@@ -231,7 +225,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
}
}
setSelectedSystem();
-
+
TDDataProviderRegisterFX.getInstance().registerDataInfo(new RawSoundProviderFX(this));
}
@@ -242,22 +236,22 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
acquisitionControl = this;
}
-
+
/**
* Overloaded constructor - used by the STAcquisitionControl class as a way to call
* the PamController.PamControlledUnit constructor without all of the AcquisitionControl
* code above
- *
+ *
* @param type the type of unit
* @param name the name of the unit
*/
public AcquisitionControl(String type, String name) {
super(type, name);
}
-
+
private PamPanel systemPanel;
-
+
protected Component getStatusBarComponent() {
PamPanel p = new PamPanel();
p.add(statusBarText = new PamLabel());
@@ -275,7 +269,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
*/
public void registerDaqSystem(DaqSystem daqSystem){
if (systemList == null) {
- systemList = new ArrayList();
+ systemList = new ArrayList<>();
}
systemList.add(daqSystem);
//daqSystem.getItemsList();
@@ -283,7 +277,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
}
public static ArrayList getControllers() {
- ArrayList daqControllers = new ArrayList();
+ ArrayList daqControllers = new ArrayList<>();
PamControlledUnit pcu;
for (int i = 0; i < PamController.getInstance().getNumControlledUnits(); i++) {
pcu = PamController.getInstance().getControlledUnit(i);
@@ -315,7 +309,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
/**
* Finds a reference to a given DAQ system based on it's type (e.g. sound card, file, etc.
* @param systemType
- * @return reference to a DaqSystem object
+ * @return reference to a DaqSystem object
*/
public DaqSystem findDaqSystem(String systemType) {
@@ -323,8 +317,8 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
if (systemType == null) systemType = acquisitionParameters.daqSystemType;
- for (int i = 0; i < systemList.size(); i++) {
- if (systemList.get(i).getSystemType().equals(systemType)) return systemList.get(i);
+ for (DaqSystem element : systemList) {
+ if (element.getSystemType().equals(systemType)) return element;
}
return null;
@@ -347,6 +341,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
this.parentFrame = parentFrame;
}
+ @Override
public void actionPerformed(ActionEvent e) {
AcquisitionParameters newParameters = AcquisitionDialog.showDialog(parentFrame, acquisitionControl, acquisitionParameters);
if (newParameters != null) {
@@ -378,28 +373,28 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
}
lastSelSystem = selSystem;
}
-
-
+
+
/**
- * Check array channels have corresponding hydrophones in the array manager. Does
- * not open a dialog to warn or fix.
- * @return check array channel. False if array manager
+ * Check array channels have corresponding hydrophones in the array manager. Does
+ * not open a dialog to warn or fix.
+ * @return check array channel. False if array manager
*/
public boolean checkArrayChannels() {
int error = arrayChannelsOK();
if (error == ARRAY_ERROR_OK) {
return true;
}
- else return false;
- }
+ else return false;
+ }
/**
- * Run a check to see that all read out channels are connected to
- * a hydrophone and if not, do something about it.
- * @return true if OK, or problem resolved.
+ * Run a check to see that all read out channels are connected to
+ * a hydrophone and if not, do something about it.
+ * @return true if OK, or problem resolved.
*/
- public boolean checkArrayChannels(Frame parentFrame) {
+ public boolean checkArrayChannels(Frame parentFrame) {
int error = arrayChannelsOK();
if (error == ARRAY_ERROR_OK) {
@@ -526,14 +521,17 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
* (non-Javadoc)
* @see PamController.PamSettings#GetSettingsReference()
*/
+ @Override
public Serializable getSettingsReference() {
return acquisitionParameters;
}
+ @Override
public long getSettingsVersion() {
return AcquisitionParameters.serialVersionUID;
}
+ @Override
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
// if (PamSettingManager.getInstance().isSettingsUnit(this, pamControlledUnitSettings)) {
@@ -568,11 +566,11 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
// converts a list of ADC channels to a list of hydrophones
public int ChannelsToHydrophones(int channels) {
int[] hydrophoneList = getHydrophoneList();
- if (hydrophoneList == null) return channels; // they are the same by default
- //In viewer mode sometimes the number of channels in sound aquisition can be lost i.e.
- //there are 0 channels. This causes bugs so if occurs return standard list.
- if (acquisitionParameters.nChannels==0) return channels;
-
+ // they are the same by default
+ //In viewer mode sometimes the number of channels in sound aquisition can be lost i.e.
+ //there are 0 channels. This causes bugs so if occurs return standard list.
+ if ((hydrophoneList == null) || (acquisitionParameters.nChannels==0)) return channels;
+
int hydrophones = 0;
int channelListIndex;
for (int i = 0; i < PamConstants.MAX_CHANNELS; i++) {
@@ -585,8 +583,8 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
}
/**
- * Return a list of which channels are connected to which hydrophones in
- * the currentarray.
+ * Return a list of which channels are connected to which hydrophones in
+ * the currentarray.
* @return List of hydrophone numbers.
*/
public int[] getHydrophoneList() {
@@ -601,15 +599,15 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
acquisitionParameters.setHydrophoneList(hydrophoneList);
}
/**
- *
- * finds the ADC channel for a given hydrophone.
+ *
+ * finds the ADC channel for a given hydrophone.
* Will return -1 if no ADC channel uses this hydrophone
- *
+ *
* @param hydrophoneId Number of a hydrophone in a PamArray
* @return the ADC channel for the given hydrophone
*/
public int findHydrophoneChannel(int hydrophoneId) {
- // finds the ADC channel for a given hydrophone.
+ // finds the ADC channel for a given hydrophone.
// will return -1 if no ADC channel uses this hydrophone
// if no list, assume 1-1 mapping
int channelList[] = acquisitionControl.acquisitionParameters.getHardwareChannelList();
@@ -664,7 +662,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
/**
* Getter for acquisition parameters.
- * @return data acquisition parameters.
+ * @return data acquisition parameters.
*/
public AcquisitionParameters getAcquisitionParameters() {
return acquisitionParameters;
@@ -679,6 +677,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
/**
* @return the offlineFileServer
*/
+ @Override
public OfflineFileServer getOfflineFileServer() {
return offlineFileServer;
}
@@ -759,15 +758,15 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
public FileDate getFileDate() {
return fileDate;
}
-
+
/**
* Load any classes that were found in the plugins folder and implement the DaqSystemInterface interface
*/
public void loadExternalDaqSystems() {
-
- // get a list of plugins
- List daqList = ((PamModel) PamController.getInstance().getModelInterface()).getDaqList();
-
+
+ // get a list of plugins
+ List daqList = PamController.getInstance().getModelInterface().getDaqList();
+
// if there are no plugins, return
if (daqList.isEmpty()) {
return;
@@ -776,7 +775,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
registerDaqSystem(dsi.createDAQControl(this));
}
}
-
+
/**
* Get the available DAQ systems
* @return
@@ -784,16 +783,16 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
public ArrayList getSystemList() {
return this.systemList;
}
-
+
/**
- * Set the acquisition parameters.
- * @param params - the acquisition params to set.
+ * Set the acquisition parameters.
+ * @param params - the acquisition params to set.
*/
public void setAquisitionParams(AcquisitionParameters params) {
this.acquisitionParameters=params;
-
+
}
-
+
@Override
public PamControlledUnitGUI getGUI(int flag) {
if (flag==PamGUIManager.FX) {
@@ -805,18 +804,18 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
//TODO swing
return null;
}
-
+
/**
- * Get a summary of the daq settings for the QA module.
- * @return summary of DAQ settings.
+ * Get a summary of the daq settings for the QA module.
+ * @return summary of DAQ settings.
*/
public String getDaqSummary() {
DaqSystem daqSys = findDaqSystem(null);
if (daqSys == null) {
return String.format("%s - currently unavailable", acquisitionParameters.daqSystemType);
}
- String str = String.format("%s - %s, %3.1fVp-p",
- acquisitionParameters.daqSystemType, daqSys.getDeviceName(),
+ String str = String.format("%s - %s, %3.1fVp-p",
+ acquisitionParameters.daqSystemType, daqSys.getDeviceName(),
acquisitionParameters.voltsPeak2Peak);
Preamplifier preamp = acquisitionParameters.getPreamplifier();
if (preamp != null) {
@@ -825,11 +824,11 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
str += ", Sample Rate " + FrequencyFormat.formatFrequency(acquisitionParameters.sampleRate, true);
return str;
}
-
+
@Override
public String tellModule(String command) {
/**
- * Get timing summary and return as a string.
+ * Get timing summary and return as a string.
*/
switch (command) {
case "gettimeinfo":
@@ -837,35 +836,35 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
}
return super.tellModule(command);
}
-
-
+
+
/**
* Get a summary of time information as to what's going on in the DAQ
* @return time summary
*/
private String getTimeInfoString() {
/*
- *
+ *
sprintf(returned,"%s:%lld,%lld,%ld,%lld",getModuleName(),calendar->getRawStartTime(),
calendar->getMillisecondTime(),(int)daqProcess->getSampleRate(),acquiredSamples);
*/
- return String.format("%s:%d,%d,%d,%d", getUnitName(), PamCalendar.getSessionStartTime(), PamCalendar.getTimeInMillis(),
+ return String.format("%s:%d,%d,%d,%d", getUnitName(), PamCalendar.getSessionStartTime(), PamCalendar.getTimeInMillis(),
(int) acquisitionProcess.getSampleRate(), acquisitionProcess.getTotalSamples(0));
}
-
+
@Override
public void pamHasStopped() {
acquisitionProcess.pamHasStopped();
}
-
+
@Override
public String getModuleSummary(boolean clear) {
return getDaqProcess().getRawDataBlock().getSummaryString(clear);
}
-
+
/**
- * Get the SUD processing notification manager.
- * @return SUD processing notification manager.
+ * Get the SUD processing notification manager.
+ * @return SUD processing notification manager.
*/
public SUDNotificationManager getSUDNotificationManager() {
if (sudNotificationManager == null) {
@@ -873,8 +872,8 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
}
return sudNotificationManager;
}
-
-
+
+
@Override
public int getRawInputType() {
DaqSystem system = acquisitionProcess.getRunningSystem();
@@ -889,17 +888,18 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
public InputStoreInfo getStoreInfo(boolean detail) {
return getDaqProcess().getStoreInfo(detail);
}
-
+
@Override
public boolean setAnalysisStartTime(long startTime) {
return getDaqProcess().setAnalysisStartTime(startTime);
}
-
+
/**
- * Very specific command handler for batch status which will only work
- * with the folderinputSystem.
+ * Very specific command handler for batch status which will only work
+ * with the folderinputSystem.
* @return
*/
+ @Override
public String getBatchStatus() {
DaqSystem runningSystem = getAcquisitionProcess().getRunningSystem();
if (runningSystem instanceof FolderInputSystem) {
@@ -909,5 +909,5 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
return null;
}
}
-
+
}
diff --git a/src/Acquisition/AcquisitionDialog.java b/src/Acquisition/AcquisitionDialog.java
index cb739bb2..a0cd6ec4 100644
--- a/src/Acquisition/AcquisitionDialog.java
+++ b/src/Acquisition/AcquisitionDialog.java
@@ -30,87 +30,87 @@ import dataMap.filemaps.OfflineFileDialogPanel;
import dataMap.filemaps.OfflineFileParameters;
/**
- * Main dialog for acquisition control. Takes plug in panels from
+ * Main dialog for acquisition control. Takes plug in panels from
* the various sound systems to give more device specific controls where
- * necessary.
- *
+ * necessary.
+ *
* @author Doug Gillespie
*
*/
public class AcquisitionDialog extends PamDialog {
private static AcquisitionParameters acquisitionParameters;
-
+
private static AcquisitionDialog singleInstance;
-
+
private static AcquisitionControl acquisitionControl;
-
+
private OfflineFileDialogPanel offlineDAQDialogPanel;
-
+
private PPSDialogPanel ppsDialogPanel;
private DaqSystem currentDaqSystem;
-
+
private JComboBox deviceType;
-
+
private JPanel mainPanel;
-
+
private JComponent deviceSpecificPanel;
-
+
private JTextField sampleRate, nChannels, vPeak2Peak;
-
- private JTextField preampGain;
+
+ private JTextField preampGain;
// bandwidth0, bandwidth1;
private JCheckBox subtractDC;
-
+
private JTextField dcTimeconstant;
-
+
// public int channelList[] = new int[PamConstants.MAX_CHANNELS];
//
// private JLabel panelChannelLabel[] = new JLabel[PamConstants.MAX_CHANNELS];
// private JComboBox panelChannelList[] = new JComboBox[PamConstants.MAX_CHANNELS];
-
+
private ChannelListPanel standardChannelListPanel = new StandardChannelListPanel();
private ChannelListPanel currentChannelListPanel;
private JPanel channelListPanelArea = new JPanel();
//private static AcquisitionParameters acquisitionParameters; //Xiao Yan Deng
-
+
/**
- * Main dialog for data acquisition control
- *
- * When shown, the dialog contains three main panels.
- *
The top one shows
- * a list of available DaqSystems (e.g. sound cards, NI cards, etc.
+ * Main dialog for data acquisition control
+ *
+ * When shown, the dialog contains three main panels.
+ *
The top one shows
+ * a list of available DaqSystems (e.g. sound cards, NI cards, etc.
* >p>
* The middle panel selected based on the type of DaqSytem and is implemented differently
* within each DaqSystem. For instance, the sound card DaqSystem displays a list
- * of available sound cards. The file system displays a list of recent files,
+ * of available sound cards. The file system displays a list of recent files,
* systems for other ADC cards mght display a channel selector and gain settings
- * specific for a particular device.
+ * specific for a particular device.
*
- * The bottom panel shows the number of channels, sample rate, and device sensitivity.
+ * The bottom panel shows the number of channels, sample rate, and device sensitivity.
* The selected DaqSystem is queried to see if these are fixed, unknown or user entered
- * and enables the controls accordingly. If they are set by the DaqSystem, the
+ * and enables the controls accordingly. If they are set by the DaqSystem, the
* DaqSystem should set them explicity using setSampleRate(), setChannels, and
- * setVPeak2Peak
+ * setVPeak2Peak
*
*/
private AcquisitionDialog (Frame parentFrame) {
super(parentFrame, "Audio Data Acquisition", false);
-
+
mainPanel = new JPanel();
-
+
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
mainPanel.add(DeviceTypePanel());
mainPanel.add(SamplingPanel());
mainPanel.add(CalibrationPanel());
-
- nChannels.addActionListener(new NumChannels());
+
+ nChannels.addActionListener(new NumChannels());
setHelpPoint("sound_processing.AcquisitionHelp.docs.AcquisitionConfiguration");
-
+
if (PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW) {
JTabbedPane tabbedPane = new JTabbedPane();
offlineDAQDialogPanel = new OfflineFileDialogPanel(acquisitionControl, this);
@@ -131,45 +131,45 @@ public class AcquisitionDialog extends PamDialog {
setParams(); //Xiao Yan Deng
sortChannelLists(); // Xiao Yan Deng
}
-
+
/**
- * Clear the static instance so that the dialog is
- * totally rebuilt next time it's launched.
+ * Clear the static instance so that the dialog is
+ * totally rebuilt next time it's launched.
*/
static public void clearInstance() {
singleInstance = null;
}
/**
- * Shows the data acquisition dialog.
+ * Shows the data acquisition dialog.
* @param daqControl the calling AcquisitionControl
* @param oldParams current parameters from the AcquisitionControl
* @return new parameters selected in the dialog
* @see AcquisitionControl
*/
static public AcquisitionParameters showDialog(Frame parentFrame, AcquisitionControl daqControl, AcquisitionParameters oldParams) {
-
+
acquisitionParameters = oldParams.clone();
-
+
acquisitionControl = daqControl;
// singleInstance = null;
-
+
if (singleInstance == null || singleInstance.getOwner() != parentFrame) {
singleInstance = new AcquisitionDialog(parentFrame);
}
-
+
singleInstance.setParams();
-
+
singleInstance.sortChannelLists();
-
+
singleInstance.setVisible(true);
-
+
singleInstance.sortChannelLists(); // Xiao Yan Deng
-
+
return acquisitionParameters;
}
-
+
private void setParams() {
-
+
// fill in the different device types.
deviceType.removeAllItems();
int ind = 0;
@@ -180,23 +180,23 @@ public class AcquisitionDialog extends PamDialog {
}
}
deviceType.setSelectedIndex(ind);
-
+
newDeviceType();
-
+
setSampleRate(acquisitionParameters.sampleRate);
-
+
setChannels(acquisitionParameters.nChannels);
-
+
setVPeak2Peak(acquisitionParameters.voltsPeak2Peak);
-
+
// preampGain.setText(String.format("%.1f", acquisitionParameters.preamplifier.getGain()));
setPreampGain(acquisitionParameters.preamplifier.getGain());
// bandwidth0.setText(String.format("%.1f", acquisitionParameters.preamplifier.getBandwidth()[0]));
// bandwidth1.setText(String.format("%.1f", acquisitionParameters.preamplifier.getBandwidth()[1]));
subtractDC.setSelected(acquisitionParameters.subtractDC);
dcTimeconstant.setText(String.format("%3.1f", acquisitionParameters.dcTimeConstant));
-
-
+
+
if (currentDaqSystem != null) currentDaqSystem.dialogSetParams();
if (currentChannelListPanel != null) {
@@ -206,24 +206,24 @@ public class AcquisitionDialog extends PamDialog {
if (offlineDAQDialogPanel != null) {
offlineDAQDialogPanel.setParams();
}
-
+
if (ppsDialogPanel != null) {
ppsDialogPanel.setParams(acquisitionParameters.getPpsParameters());
}
-
+
enableControls();
}
/**
* Called by the specific DaqSystem to set sample rate when it is set by
- * the DaqSystem (for instance FileInputSystem will set sample rate to the
- * sample rate of data in the current file.
+ * the DaqSystem (for instance FileInputSystem will set sample rate to the
+ * sample rate of data in the current file.
* @param sampleRate Current sample rate
*/
public void setSampleRate(float sampleRate) {
this.sampleRate.setText(String.format("%.0f", sampleRate));
}
-
+
/**
* Get the sample rate, or null if sample rate is not a valid number
* @return sample rate or null
@@ -239,15 +239,15 @@ public class AcquisitionDialog extends PamDialog {
/**
* Called by the specific DaqSystem to set the number of channels when it is set by
- * the DaqSystem (for instance FileInputSystem will set it to the
- * number of channels in the current file.
+ * the DaqSystem (for instance FileInputSystem will set it to the
+ * number of channels in the current file.
* @param nChannels Number of channels
*/
public void setChannels(int nChannels) {
this.nChannels.setText(String.format("%d", nChannels));
}
-
- /**
+
+ /**
* @return the number of channels or null if invalid number
*/
public Integer getChannels() {
@@ -258,7 +258,7 @@ public class AcquisitionDialog extends PamDialog {
return null;
}
}
-
+
public void setPreampGain(double gain) {
preampGain.setText(String.format("%.1f", gain));
}
@@ -266,13 +266,13 @@ public class AcquisitionDialog extends PamDialog {
/**
* Called by the specific DaqSystem to set the peak to peak voltage range.
* This is used for calculating absolute SPL's in various detectors
- * the DaqSystem
+ * the DaqSystem
* @param vPeak2Peak Peak to Peak input voltage
*/
public void setVPeak2Peak(double vPeak2Peak) {
this.vPeak2Peak.setText(String.format("%4.3f", vPeak2Peak));
}
-
+
// read parameters back from the dialog
@Override
public boolean getParams() {
@@ -287,15 +287,15 @@ public class AcquisitionDialog extends PamDialog {
// bw[0] = Double.valueOf(bandwidth0.getText());
// bw[1] = Double.valueOf(bandwidth1.getText());
// acquisitionParameters.preamplifier.setBandwidth(bw);
-
- if(!currentDaqSystem.areSampleSettingsOk(acquisitionParameters.nChannels, acquisitionParameters.sampleRate)){
+
+ if(!currentDaqSystem.areSampleSettingsOk(acquisitionParameters.nChannels, acquisitionParameters.sampleRate)){
currentDaqSystem.showSampleSettingsDialog(this);
return false;
- }
-
+ }
+
int nP = getNumChannels();
if (getCurrentDaqSystem().supportsChannelLists() && currentChannelListPanel != null) {
- if (currentChannelListPanel.isDataOk() == false) {
+ if (!currentChannelListPanel.isDataOk()) {
return false;
}
int[] chL = currentChannelListPanel.getChannelList();
@@ -312,7 +312,7 @@ public class AcquisitionDialog extends PamDialog {
Ex.printStackTrace();
return false;
}
-
+
acquisitionParameters.subtractDC = subtractDC.isSelected();
if (acquisitionParameters.subtractDC) {
try {
@@ -325,8 +325,8 @@ public class AcquisitionDialog extends PamDialog {
return showWarning("The DC bacround subtractino time constant must be greater than zero");
}
}
-
-
+
+
if (offlineDAQDialogPanel != null) {
OfflineFileParameters ofp = offlineDAQDialogPanel.getParams();
if (ofp == null) {
@@ -346,13 +346,13 @@ public class AcquisitionDialog extends PamDialog {
return false;
}
}
-
+
return true;
}
-
- /**
- * Read the latest sample rate value.
- * @return sample rate Hz.
+
+ /**
+ * Read the latest sample rate value.
+ * @return sample rate Hz.
*/
public double readSampleRate() {
double sr = 0;
@@ -365,22 +365,24 @@ public class AcquisitionDialog extends PamDialog {
return sr;
}
-
+
@Override
public void cancelButtonPressed() {
acquisitionParameters = null;
}
@Override
public void restoreDefaultSettings() {
-
+
}
-
+
private class NewDeviceType implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
newDeviceType();
}
}
private class NumChannels implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
sortChannelLists();
}
@@ -395,7 +397,7 @@ public class AcquisitionDialog extends PamDialog {
deviceType.addActionListener(new NewDeviceType());
return p;
}
-
+
/**
* Only need to show the channel panel for certain device types,
*
@@ -415,20 +417,20 @@ public class AcquisitionDialog extends PamDialog {
channelListPanelArea.add(standardChannelListPanel.getComponent());
// channelListPanel.setVisible(currentSystem.supportsChannelLists());
}
-
+
}
-
+
private JPanel SamplingPanel () {
-
+
JPanel sP = new PamAlignmentPanel(new BorderLayout(), BorderLayout.WEST);
-
+
JPanel p = new JPanel();
sP.setBorder(new TitledBorder("Sampling"));
GridBagLayout layout;
-
+
p.setLayout(layout = new GridBagLayout());
GridBagConstraints constraints = new PamGridBagContraints();
-
+
constraints.anchor = GridBagConstraints.EAST;
constraints.insets = new Insets(2,2,2,2);
constraints.fill = GridBagConstraints.NONE;
@@ -450,31 +452,31 @@ public class AcquisitionDialog extends PamDialog {
constraints.gridx ++;
constraints.gridwidth = 2;
addComponent(p, new JLabel(" (hit enter)"), constraints);
-
+
sP.add(BorderLayout.NORTH, p);
-
+
// constraints.gridy++;
// constraints.gridx = 0;
// constraints.gridwidth = 4;
standardChannelListPanel = new StandardChannelListPanel();
// addComponent(p, channelListPanel, constraints);
-
+
constraints.insets = new Insets(2,2,2,2);
-
-
+
+
sP.add(BorderLayout.CENTER, channelListPanelArea);
-
+
return sP;
}
-
-//
+
+//
// private JPanel createStandardChannelListPanel() {
//
// /* code for select channel */
// /*
-// * put this in a separate panel so it can be hidden if
-// * it's not possible to change these parameters.
-// *
+// * put this in a separate panel so it can be hidden if
+// * it's not possible to change these parameters.
+// *
// * Text information updated DG & JG 12/8/08
// */
// JPanel cP;
@@ -494,7 +496,7 @@ public class AcquisitionDialog extends PamDialog {
// s += "
So be aware. If you've put a plug into socket 1,
you probably want to select channel 0, etc.