FDA-98
Improved (standalone) main method to also support stopping the data acquisition
This commit is contained in:
@@ -3,15 +3,21 @@ This software is used to readout the FDAQ box developed at X10SA.
|
||||
On The FDAQ box there are 2 socket servers, one for retrieving the data and one for resetting the socket
|
||||
server for data retrieval.
|
||||
|
||||
The fdaq code provides exactly 2 to functionalities, it can query on the data socket for data (specifying how many data point)
|
||||
and can send a reset request on the reset channel.
|
||||
The fdaq code provides exactly 2 functionalities. It can query on the data socket for data (need to specifying how many data point to read),
|
||||
and it can send a reset request on the reset channel.
|
||||
|
||||
# Usage
|
||||
|
||||
To acquire data into a file use:
|
||||
|
||||
```
|
||||
fdaq <file>
|
||||
fdaq acquire <file>
|
||||
```
|
||||
|
||||
Send stop/reset request (to abort an data collection)
|
||||
|
||||
```
|
||||
fdaq stop
|
||||
```
|
||||
|
||||
This will take the default connections settings:
|
||||
|
||||
@@ -26,26 +26,42 @@ import ch.psi.fda.serializer.SerializerTXT;
|
||||
import com.google.common.eventbus.AsyncEventBus;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class FdaqMain {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
if(args.length != 1){
|
||||
System.err.println("Usage: fdaq <file>");
|
||||
if(args.length < 1 || args.length >2){
|
||||
System.err.println("Usage:\n fdaq acquire <file>\n fdaq stop");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
File file = new File(args[0]);
|
||||
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");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
EventBus bus = new AsyncEventBus(Executors.newSingleThreadExecutor());
|
||||
FdaqService fdaq = new FdaqService(bus);
|
||||
|
||||
SerializerTXT serializer = new SerializerTXT(file);
|
||||
bus.register(serializer);
|
||||
|
||||
fdaq.acquire();
|
||||
|
||||
if(acquire){
|
||||
SerializerTXT serializer = new SerializerTXT(file);
|
||||
bus.register(serializer);
|
||||
|
||||
fdaq.acquire();
|
||||
}
|
||||
else{
|
||||
fdaq.stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user