Added hack for fdaq readout
This commit is contained in:
@@ -92,6 +92,11 @@
|
||||
<version>0.9.6-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.psi</groupId>
|
||||
<artifactId>ch.psi.fdaq</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
@@ -34,6 +34,7 @@
|
||||
</Group>
|
||||
<EmptySpace pref="108" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jPanel1" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
@@ -51,7 +52,8 @@
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="187" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -95,5 +97,76 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="jTextField2" min="-2" pref="176" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jButton2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="113" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jTextField2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="90" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/cdump/Bundle.properties" key="CdumpExecutionTopComponent.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/cdump/Bundle.properties" key="CdumpExecutionTopComponent.jLabel4.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="jTextField2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/cdump/Bundle.properties" key="CdumpExecutionTopComponent.jTextField2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="ch/psi/fda/ui/cdump/Bundle.properties" key="CdumpExecutionTopComponent.jButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -20,6 +20,8 @@ import ch.psi.cdump.CdumpConfiguration;
|
||||
import ch.psi.cdump.CdumpService;
|
||||
import ch.psi.cdump.RunConfiguration;
|
||||
import ch.psi.fda.ui.preferences.api.Preferences;
|
||||
import ch.psi.fdaq.FdaqConfiguration;
|
||||
import ch.psi.fdaq.FdaqService;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Level;
|
||||
@@ -47,6 +49,7 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
private static final String PREFERRED_ID = "CdumpExecutionTopComponent";
|
||||
|
||||
private CdumpService service;
|
||||
private FdaqService fdaqService;
|
||||
|
||||
public CdumpExecutionTopComponent() {
|
||||
initComponents();
|
||||
@@ -73,6 +76,11 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
jTextField1 = new javax.swing.JTextField();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
jTextField2 = new javax.swing.JTextField();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
|
||||
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(RunConfiguration.rates));
|
||||
|
||||
@@ -89,6 +97,48 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
}
|
||||
});
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(CdumpExecutionTopComponent.class, "CdumpExecutionTopComponent.jLabel3.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(CdumpExecutionTopComponent.class, "CdumpExecutionTopComponent.jLabel4.text")); // NOI18N
|
||||
|
||||
jTextField2.setText(org.openide.util.NbBundle.getMessage(CdumpExecutionTopComponent.class, "CdumpExecutionTopComponent.jTextField2.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jButton2, org.openide.util.NbBundle.getMessage(CdumpExecutionTopComponent.class, "CdumpExecutionTopComponent.jButton2.text")); // NOI18N
|
||||
jButton2.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton2ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel3)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jLabel4)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(jButton2))
|
||||
.addContainerGap(113, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel3)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel4)
|
||||
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jButton2)
|
||||
.addContainerGap(90, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -106,6 +156,7 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE)))
|
||||
.addComponent(jButton1))
|
||||
.addContainerGap(108, Short.MAX_VALUE))
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -120,7 +171,8 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jButton1)
|
||||
.addContainerGap(187, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
@@ -163,12 +215,56 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
}
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
|
||||
if(jButton2.getText().equals("Start")){
|
||||
try{
|
||||
// Start acquisition
|
||||
startAcquisitionFdaq();
|
||||
jButton2.setText("Stop");
|
||||
}
|
||||
catch(Exception e){
|
||||
NotifyDescriptor d = new NotifyDescriptor.Message("Unable to start data acquisition:\n" + e.getMessage(), NotifyDescriptor.ERROR_MESSAGE);
|
||||
DialogDisplayer.getDefault().notifyLater(d);
|
||||
|
||||
// Print exception to output window of the application
|
||||
InputOutput io = IOProvider.getDefault().getIO("Error", false);
|
||||
// Set output console visible
|
||||
io.select();
|
||||
io.getOut().println("Cannot start fdaq");
|
||||
e.printStackTrace(io.getErr());
|
||||
}
|
||||
}
|
||||
else {
|
||||
try{
|
||||
// Stop acquisition
|
||||
jButton2.setText("Start");
|
||||
stopAcquisitionFdaq();
|
||||
}
|
||||
catch(Exception e){
|
||||
NotifyDescriptor d = new NotifyDescriptor.Message("Unable to stop data acquisition:\n" + e.getMessage(), NotifyDescriptor.ERROR_MESSAGE);
|
||||
DialogDisplayer.getDefault().notifyLater(d);
|
||||
|
||||
// Print exception to output window of the application
|
||||
InputOutput io = IOProvider.getDefault().getIO("Error", false);
|
||||
// Set output console visible
|
||||
io.select();
|
||||
io.getOut().println("Cannot stop fdaq");
|
||||
e.printStackTrace(io.getErr());
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_jButton2ActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton2;
|
||||
private javax.swing.JComboBox jComboBox1;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JTextField jTextField1;
|
||||
private javax.swing.JTextField jTextField2;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
/**
|
||||
* Gets default instance. Do not use directly: reserved for *.settings files only,
|
||||
@@ -288,4 +384,34 @@ public final class CdumpExecutionTopComponent extends TopComponent {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
public void startAcquisitionFdaq() {
|
||||
Preferences p = Lookup.getDefault().lookup(Preferences.class);
|
||||
System.setProperty(FdaqService.APP_HOME, p.getHome().getAbsolutePath());
|
||||
|
||||
Logger.getLogger(CdumpExecutionTopComponent.class.getName()).log(Level.INFO, "Start fdaq acquisition");
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,3 +10,7 @@ CdumpExecutionTopComponent.jButton1.text=Start
|
||||
CTL_CdumpExecutionAction=Stream Detector Acquisition
|
||||
CTL_CdumpExecutionTopComponent=Stream Detector Acquisition
|
||||
HINT_CdumpExecutionTopComponent=This is a Continuous Execution window
|
||||
CdumpExecutionTopComponent.jLabel3.text=Fdaq Testing
|
||||
CdumpExecutionTopComponent.jLabel4.text=Scan Name
|
||||
CdumpExecutionTopComponent.jTextField2.text=
|
||||
CdumpExecutionTopComponent.jButton2.text=Start
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# To change this template, choose Tools | Templates
|
||||
# and open the template in the editor.
|
||||
|
||||
# Localized module labels. Defaults taken from POM (<name>, <description>, <groupId>) if unset.
|
||||
#OpenIDE-Module-Name=
|
||||
#OpenIDE-Module-Short-Description=
|
||||
#OpenIDE-Module-Long-Description=
|
||||
#OpenIDE-Module-Display-Category=
|
||||
FdaqTopComponent.jLabel1.text=Sampling Rate
|
||||
FdaqTopComponent.jTextField1.text=
|
||||
FdaqTopComponent.jLabel2.text=Scan Name
|
||||
FdaqTopComponent.jButton1.text=Start
|
||||
# Localized module labels. Defaults taken from POM (<name>, <description>, <groupId>) if unset.
|
||||
#OpenIDE-Module-Name=
|
||||
#OpenIDE-Module-Short-Description=
|
||||
#OpenIDE-Module-Long-Description=
|
||||
#OpenIDE-Module-Display-Category=
|
||||
FdaqTopComponent.jLabel1.text_1=Sampling Rate
|
||||
FdaqTopComponent.jTextField1.text_1=
|
||||
FdaqTopComponent.jLabel2.text_1=Scan Name
|
||||
FdaqTopComponent.jButton1.text_1=Start
|
||||
Reference in New Issue
Block a user