diff --git a/src/networkTransfer/send/NetworkSender.java b/src/networkTransfer/send/NetworkSender.java index 59e8d7ed..65f2774b 100644 --- a/src/networkTransfer/send/NetworkSender.java +++ b/src/networkTransfer/send/NetworkSender.java @@ -23,10 +23,12 @@ import javax.swing.SwingWorker; import networkTransfer.emulator.NetworkEmulator; import networkTransfer.receive.NetworkReceiver; +import pamguard.GlobalArguments; import org.w3c.dom.Document; import org.w3c.dom.Element; +import Acquisition.FolderInputSystem; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; @@ -44,6 +46,11 @@ import PamguardMVC.PamDataBlock; * */ public class NetworkSender extends PamControlledUnit implements PamSettings { + + public static final String ADDRESS = "-netSend.address"; + public static final String PORT = "-netSend.port"; + public static final String ID1 = "-netSend.id1"; + public static final String ID2 = "-netSend.id2"; protected NetworkSendParams networkSendParams = new NetworkSendParams(); private NetworkEmulator networkEmulator; @@ -169,6 +176,28 @@ public class NetworkSender extends PamControlledUnit implements PamSettings { public boolean restoreSettings( PamControlledUnitSettings pamControlledUnitSettings) { networkSendParams = ((NetworkSendParams) pamControlledUnitSettings.getSettings()).clone(); + + String address = GlobalArguments.getParam(ADDRESS); + String portString = GlobalArguments.getParam(PORT); + String id1String = GlobalArguments.getParam(ID1); + String id2String = GlobalArguments.getParam(ID2); + + if (address != null) { + networkSendParams.ipAddress = address; // remember it. + } + + if(portString != null) { + networkSendParams.portNumber = Integer.valueOf(portString); + } + + if(id1String!=null) { + networkSendParams.stationId1 = Integer.valueOf(id1String); + } + + if(id2String!=null) { + networkSendParams.stationId1 = Integer.valueOf(id2String); + } + return (networkSendParams != null); } diff --git a/src/pamguard/Pamguard.java b/src/pamguard/Pamguard.java index 1a83706c..8a2a66c7 100644 --- a/src/pamguard/Pamguard.java +++ b/src/pamguard/Pamguard.java @@ -42,6 +42,7 @@ import PamguardMVC.debug.Debug; import binaryFileStorage.BinaryStore; import dataPlotsFX.JamieDev; import generalDatabase.DBControl; +import networkTransfer.send.NetworkSender; import rocca.RoccaDev; import java.io.BufferedReader; @@ -271,6 +272,23 @@ public class Pamguard { GlobalArguments.setParam(PamController.AUTOEXIT, PamController.AUTOEXIT); System.out.println("Setting autoexit ON"); } + else if (anArg.equalsIgnoreCase(NetworkSender.ADDRESS)) { + // auto exit at end of processing. + GlobalArguments.setParam(NetworkSender.ADDRESS, args[iArg++]); + } + else if (anArg.equalsIgnoreCase(NetworkSender.ID1)) { + // auto exit at end of processing. + GlobalArguments.setParam(NetworkSender.ID1, args[iArg++]); + } + else if (anArg.equalsIgnoreCase(NetworkSender.ID2)) { + // auto exit at end of processing. + GlobalArguments.setParam(NetworkSender.ID2, args[iArg++]); + } + else if (anArg.equalsIgnoreCase(NetworkSender.PORT)) { + // auto exit at end of processing. + GlobalArguments.setParam(NetworkSender.PORT, args[iArg++]); + } + else if (anArg.equalsIgnoreCase("-help")) { System.out.println("--PamGuard Help"); System.out.println("\n--For standard GUI deployment run without any options.\n");