Fix to issue #80 (#81)

* Fix network sender since it was hopelessly out of date and did not send
data in the correct format. OK now, though only tested on NARW.

* Fix network sender since it was hopelessly out of date and did not send
data in the correct format. OK now, though only tested on NARW.

* Mods to support command line and Network control of PAMGuard and to
retrieve summary information from some modules.

* Fix issue #80: recording path command line override

* Allow RUNNOTHING bearing calculations

Co-authored-by: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com>
This commit is contained in:
stabbutt 2022-11-08 01:02:52 -08:00 committed by GitHub
parent d2e69c507e
commit fe0fe11faf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import javax.swing.Timer;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import Acquisition.FolderInputSystem;
import PamController.PamControlledUnit; import PamController.PamControlledUnit;
import PamController.PamControlledUnitSettings; import PamController.PamControlledUnitSettings;
import PamController.PamController; import PamController.PamController;
@ -24,6 +25,7 @@ import PamController.PamControllerInterface;
import PamController.PamSettingManager; import PamController.PamSettingManager;
import PamController.PamSettings; import PamController.PamSettings;
import PamController.command.CommandManager; import PamController.command.CommandManager;
import PamUtils.FileFunctions;
import PamUtils.PamCalendar; import PamUtils.PamCalendar;
import PamUtils.PamUtils; import PamUtils.PamUtils;
import PamView.MenuItemEnabler; import PamView.MenuItemEnabler;
@ -35,6 +37,7 @@ import SoundRecorder.trigger.RecorderTrigger;
import SoundRecorder.trigger.RecorderTriggerData; import SoundRecorder.trigger.RecorderTriggerData;
import SoundRecorder.trigger.TriggerDecisionMaker; import SoundRecorder.trigger.TriggerDecisionMaker;
import backupmanager.BackupInformation; import backupmanager.BackupInformation;
import pamguard.GlobalArguments;
/** /**
* Control a sound file recorder. The sound file recorder has two * Control a sound file recorder. The sound file recorder has two
@ -434,9 +437,51 @@ public class RecorderControl extends PamControlledUnit implements PamSettings {
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
recorderSettings = ((RecorderSettings) pamControlledUnitSettings.getSettings()).clone(); recorderSettings = ((RecorderSettings) pamControlledUnitSettings.getSettings()).clone();
newParams(); newParams();
/*
* Then check to see if there is a command line override of the currently stored folder name.
*/
String globFolder = GlobalArguments.getParam(FolderInputSystem.GlobalWavFolderArg);
if (globFolder != null) {
boolean ok = checkGlobFolder(globFolder);
if (ok) {
recorderSettings.setOutputFolder(globFolder); // remember it.
}
else {
System.err.println("Unable to set recording storage folder " + globFolder);
}
}
return true; return true;
} }
/**
* Set and create if necessary the global folder.
* @param globFolder
*/
private boolean checkGlobFolder(String globFolder) {
File outFold = new File(globFolder);
if (outFold.exists()) {
if (outFold.isDirectory()) {
return true; // all OK
}
else {
return false; // it must be a file - that's bad !
}
}
// try to create it.
try {
if (outFold.mkdirs()) {
FileFunctions.setNonIndexingBit(outFold);
return true;
}
else {
return false; // unable to make the folder.
}
}
catch (Exception e) {
System.err.println("Can't set recording store folder: " + e.getLocalizedMessage());
return false;
}
}
/** /**
* Adds a recorder trigger to this recorderControl. This can either be called * Adds a recorder trigger to this recorderControl. This can either be called

View File

@ -64,6 +64,10 @@ public class RecorderSettings implements Serializable, Cloneable, ManagedParamet
*/ */
public String outputFolder; public String outputFolder;
public void setOutputFolder(String outputFolder) {
this.outputFolder = outputFolder;
}
/** /**
* Initials to add to the start of a file name, the rest * Initials to add to the start of a file name, the rest
* of which is made up from the date. * of which is made up from the date.

View File

@ -278,7 +278,7 @@ public class WhistleBinaryDataSource extends BinaryDataSource {
* If we're n network receive mode, we can't do this until * If we're n network receive mode, we can't do this until
* channel numbers have been reassigned. * channel numbers have been reassigned.
*/ */
if (runMode == PamController.RUN_PAMVIEW && delays != null) { if ((runMode == PamController.RUN_PAMVIEW || runMode == PamController.RUN_NOTHING) && delays != null) {
ShapeConnector shapeConnector = wmDetector.findShapeConnector(channelMap); ShapeConnector shapeConnector = wmDetector.findShapeConnector(channelMap);
if (shapeConnector != null) { if (shapeConnector != null) {
BearingLocaliser bl = shapeConnector.getBearingLocaliser(); BearingLocaliser bl = shapeConnector.getBearingLocaliser();