removed explicit stop command from cli client
This commit is contained in:
@@ -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-<version>.jar acquire <file>
|
||||
java -jar ch.psi.fda.fdaq-<version>.jar <file>
|
||||
```
|
||||
|
||||
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-<version>.jar stop
|
||||
```
|
||||
|
||||
This will take the default connections settings:
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>ch.psi</groupId>
|
||||
<artifactId>ch.psi.fda.fdaq</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<version>1.0.4</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -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 <file>\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 <file>\n fdaq stop");
|
||||
if(args.length != 1){
|
||||
System.err.println("Usage:\n fdaq <file>");
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user