From 10072d2c8599147964cb36323b72f4f610c37bd8 Mon Sep 17 00:00:00 2001 From: Simon Ebner Date: Wed, 22 Jan 2014 11:11:12 +0100 Subject: [PATCH] removed explicit stop command from cli client --- ch.psi.fda.fdaq/Readme.md | 6 +- ch.psi.fda.fdaq/pom.xml | 2 +- .../main/java/ch/psi/fda/fdaq/FdaqMain.java | 70 +++++++------------ 3 files changed, 28 insertions(+), 50 deletions(-) diff --git a/ch.psi.fda.fdaq/Readme.md b/ch.psi.fda.fdaq/Readme.md index 6769c32..9a64911 100644 --- a/ch.psi.fda.fdaq/Readme.md +++ b/ch.psi.fda.fdaq/Readme.md @@ -11,16 +11,12 @@ and it can send a reset request on the reset channel. To acquire data into a file use: ``` -java -jar java -jar ch.psi.fda.fdaq-.jar acquire +java -jar ch.psi.fda.fdaq-.jar ``` You can terminate the acquisition with *CTRL+C*. If you submit 2 consequtive *CTRL+C* the program will terminate immediately (and data might be lost); -Send stop/reset request (to abort an data collection) -``` -java -jar java -jar ch.psi.fda.fdaq-.jar stop -``` This will take the default connections settings: diff --git a/ch.psi.fda.fdaq/pom.xml b/ch.psi.fda.fdaq/pom.xml index 70b9b24..60e3887 100644 --- a/ch.psi.fda.fdaq/pom.xml +++ b/ch.psi.fda.fdaq/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ch.psi ch.psi.fda.fdaq - 1.0.3 + 1.0.4 diff --git a/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqMain.java b/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqMain.java index 1ab402e..d4ae074 100644 --- a/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqMain.java +++ b/ch.psi.fda.fdaq/src/main/java/ch/psi/fda/fdaq/FdaqMain.java @@ -33,61 +33,43 @@ public class FdaqMain { public static void main(String[] args) { - if(args.length < 1 || args.length >2){ - System.err.println("Usage:\n fdaq acquire \n fdaq stop"); - System.exit(-1); - } - - boolean acquire = false; - File file = null; - if(args[0].equals("acquire")){ - acquire = true; - file = new File(args[1]); - } - else if(args[0].equals("stop")){ - } - else{ - System.err.println("Usage:\n fdaq acquire \n fdaq stop"); + if(args.length != 1){ + System.err.println("Usage:\n fdaq "); System.exit(-1); } + File file = new File(args[1]); EventBus bus = new AsyncEventBus(Executors.newSingleThreadExecutor()); final FdaqService fdaq = new FdaqService(bus); - if(acquire){ - - Signal.handle(new Signal("INT"), new SignalHandler() { - int count = 0; - public void handle(Signal sig) { - if(count < 1){ - fdaq.stop(); - count++; - return; - } - System.exit(0); + Signal.handle(new Signal("INT"), new SignalHandler() { + int count = 0; + public void handle(Signal sig) { + if(count < 1){ + fdaq.stop(); + count++; + return; } - }); - - SerializerTXT serializer = new SerializerTXT(file); - serializer.setShowDimensionHeader(false); - bus.register(serializer); - - // This stop ensures that the data server is in a good shape (i.e. gets restarted) - // We need to wait a certain amount of time to have the server restarted. - fdaq.stop(); - try { - Thread.sleep(1000); // TODO check whether this sleep is really necessary - } catch (InterruptedException e) { - e.printStackTrace(); + System.exit(0); } - - fdaq.acquire(); - } - else{ - fdaq.stop(); + }); + + SerializerTXT serializer = new SerializerTXT(file); + serializer.setShowDimensionHeader(false); + bus.register(serializer); + + // This stop ensures that the data server is in a good shape (i.e. gets restarted) + // We need to wait a certain amount of time to have the server restarted. + fdaq.stop(); + try { + Thread.sleep(1000); // TODO check whether this sleep is really necessary + } catch (InterruptedException e) { + e.printStackTrace(); } + + fdaq.acquire(); } }