Upgraded used fdaq library
This commit is contained in:
@@ -126,8 +126,8 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.psi</groupId>
|
||||
<artifactId>ch.psi.fdaq</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<artifactId>ch.psi.fda.fdaq</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
||||
@@ -19,10 +19,10 @@ package ch.psi.fda.ui.cdump;
|
||||
import ch.psi.fda.aq.AcquisitionConfiguration;
|
||||
import ch.psi.fda.cdump.Cdump;
|
||||
import ch.psi.fda.cdump.CdumpConfiguration;
|
||||
import ch.psi.fda.fdaq.Fdaq;
|
||||
import ch.psi.fda.fdaq.FdaqConfiguration;
|
||||
import ch.psi.fda.serializer.SerializerTXT;
|
||||
import ch.psi.fda.ui.preferences.api.Preferences;
|
||||
import ch.psi.fdaq.FdaqConfiguration;
|
||||
import ch.psi.fdaq.FdaqService;
|
||||
import ch.psi.jcae.ChannelService;
|
||||
import ch.psi.jcae.impl.DefaultChannelService;
|
||||
import com.google.common.eventbus.AsyncEventBus;
|
||||
@@ -54,7 +54,7 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
|
||||
final ChannelService cservice = new DefaultChannelService();
|
||||
private Cdump service;
|
||||
private FdaqService fdaqService;
|
||||
private Fdaq fdaqService;
|
||||
|
||||
public CdumpExecutionTopComponent() {
|
||||
initComponents();
|
||||
@@ -385,29 +385,60 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
|
||||
public void startAcquisitionFdaq() {
|
||||
Preferences p = Lookup.getDefault().lookup(Preferences.class);
|
||||
System.setProperty(FdaqService.APP_HOME, p.getHome().getAbsolutePath());
|
||||
// TODO currently only the hardcoded configurations are supported
|
||||
// The ch.psi.fda.fdaq.config.file configuration file is not set base on FDA_HOME ...
|
||||
|
||||
FdaqConfiguration configuration = new FdaqConfiguration();
|
||||
|
||||
EventBus bus = new AsyncEventBus(Executors.newSingleThreadExecutor());
|
||||
fdaqService = new Fdaq(bus, configuration);
|
||||
|
||||
String fname = jTextField2.getText();
|
||||
AcquisitionConfiguration config = ch.psi.fda.ui.ee.Configuration.getInstance().getConfiguration();
|
||||
String fileName = config.getDataBaseDirectory() + "/" + config.replaceMacros(config.getDataFilePrefix(), new Date(), fname) + fname + ".txt";
|
||||
|
||||
File f = new File(fileName);
|
||||
f.getParentFile().mkdirs(); // Create data base directory
|
||||
|
||||
SerializerTXT serializer = new SerializerTXT(f, false);
|
||||
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.
|
||||
fdaqService.stop();
|
||||
try {
|
||||
Thread.sleep(1000); // TODO check whether this sleep is really necessary
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Logger.getLogger(CdumpExecutionTopComponent.class.getName()).log(Level.INFO, "Start fdaq acquisition");
|
||||
fdaqService.acquire();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Calculate data file location/name
|
||||
String fname = jTextField2.getText();
|
||||
FdaqConfiguration cc = FdaqConfiguration.getInstance();
|
||||
String d = cc.getDataDirectory() + "/" + cc.replaceMacros(cc.getFilePrefix(), new Date(), fname) + fname + ".txt";
|
||||
File f = new File(d);
|
||||
f.getParentFile().mkdirs(); // Create data base directory
|
||||
|
||||
// Create execution service
|
||||
fdaqService = new FdaqService();
|
||||
|
||||
// Take data
|
||||
fdaqService.startAcquisition(f);
|
||||
// // Calculate data file location/name
|
||||
// String fname = jTextField2.getText();
|
||||
// FdaqConfiguration cc = FdaqConfiguration.getInstance();
|
||||
// String d = cc.getDataDirectory() + "/" + cc.replaceMacros(cc.getFilePrefix(), new Date(), fname) + fname + ".txt";
|
||||
// File f = new File(d);
|
||||
// f.getParentFile().mkdirs(); // Create data base directory
|
||||
//
|
||||
// // Create execution service
|
||||
// fdaqService = new FdaqService();
|
||||
//
|
||||
// // Take data
|
||||
// fdaqService.startAcquisition(f);
|
||||
}
|
||||
|
||||
public void stopAcquisitionFdaq() {
|
||||
|
||||
if(fdaqService != null){
|
||||
Logger.getLogger(CdumpExecutionTopComponent.class.getName()).log(Level.INFO, "Stop fdaq acquisition");
|
||||
fdaqService.stopAcquisition();
|
||||
fdaqService.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user