530 lines
19 KiB
Java
530 lines
19 KiB
Java
package org.hwo.pulscounter.ui;
|
|
|
|
import java.awt.BorderLayout;
|
|
import java.awt.EventQueue;
|
|
|
|
import javax.swing.JFrame;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.border.EmptyBorder;
|
|
import javax.swing.event.ChangeEvent;
|
|
import javax.swing.event.ChangeListener;
|
|
|
|
import org.hwo.pulscounter.PulsCounterApplication;
|
|
import org.hwo.pulscounter.device.IDeviceConnector;
|
|
import org.hwo.servicelink.ServiceLink;
|
|
import org.hwo.servicelink.exceptions.*;
|
|
|
|
import java.awt.GridLayout;
|
|
import javax.swing.JTabbedPane;
|
|
import java.awt.GridBagLayout;
|
|
import java.awt.GridBagConstraints;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JOptionPane;
|
|
|
|
import java.awt.Insets;
|
|
import java.awt.Dialog.ModalityType;
|
|
import java.awt.Dimension;
|
|
import javax.swing.JComboBox;
|
|
import javax.swing.JDialog;
|
|
|
|
import java.awt.event.ActionListener;
|
|
import java.io.IOException;
|
|
import java.math.BigInteger;
|
|
import java.util.Arrays;
|
|
import java.awt.event.ActionEvent;
|
|
import javax.swing.JCheckBox;
|
|
import javax.swing.JSpinner;
|
|
import javax.swing.SpinnerNumberModel;
|
|
import javax.swing.JButton;
|
|
|
|
import org.hwo.bitfields.BitField;
|
|
import org.hwo.bitfields.Field;
|
|
import org.hwo.bitfields.ui.BitFieldEditor;
|
|
import org.hwo.i18n.Messages;
|
|
import org.hwo.models.TableMapper.TableColumn;
|
|
import org.hwo.models.TableMapper.TableMapper;
|
|
import org.hwo.ui.JTimeSpanEditor;
|
|
import java.awt.event.FocusAdapter;
|
|
import java.awt.event.FocusEvent;
|
|
import javax.swing.JScrollPane;
|
|
import javax.swing.JTable;
|
|
|
|
public class DeviceConfiguration extends JDialog {
|
|
|
|
private JPanel contentPane;
|
|
|
|
|
|
int currentChannel;
|
|
private BitFieldEditor bfeIntervall;
|
|
private JTimeSpanEditor tseI3;
|
|
private JTimeSpanEditor tseI2;
|
|
private JTimeSpanEditor tseI1;
|
|
private JTimeSpanEditor tseI0;
|
|
|
|
private TableMapper tmSettings;
|
|
|
|
int outputs,
|
|
pullups,
|
|
inverts,
|
|
trigger;
|
|
|
|
int[] filter,
|
|
windows,
|
|
increments;
|
|
|
|
private JTable tSettings;
|
|
|
|
private IDeviceConnector deviceConnector;
|
|
private JPanel pManagement;
|
|
private JButton btnSnapshotSpeicherZurcksetzen;
|
|
private JButton btnSnapshotSpeicherAuf;
|
|
private JButton btnAlleZhlerLschen;
|
|
|
|
/**
|
|
* Create the frame.
|
|
*/
|
|
public DeviceConfiguration(IDeviceConnector deviceConnector) {
|
|
this.deviceConnector = deviceConnector;
|
|
|
|
setModalityType(ModalityType.APPLICATION_MODAL);
|
|
|
|
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
|
setBounds(100, 100, 860, 498);
|
|
contentPane = new JPanel();
|
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
|
setContentPane(contentPane);
|
|
GridBagLayout gbl_contentPane = new GridBagLayout();
|
|
gbl_contentPane.columnWidths = new int[] {30, 0, 0};
|
|
gbl_contentPane.rowHeights = new int[] {183, 0};
|
|
gbl_contentPane.columnWeights = new double[]{1.0, 0.0, 0.0};
|
|
gbl_contentPane.rowWeights = new double[]{1.0, 0.0};
|
|
contentPane.setLayout(gbl_contentPane);
|
|
|
|
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
GridBagConstraints gbc_tabbedPane = new GridBagConstraints();
|
|
gbc_tabbedPane.gridwidth = 3;
|
|
gbc_tabbedPane.fill = GridBagConstraints.BOTH;
|
|
gbc_tabbedPane.insets = new Insets(0, 0, 5, 0);
|
|
gbc_tabbedPane.gridx = 0;
|
|
gbc_tabbedPane.gridy = 0;
|
|
contentPane.add(tabbedPane, gbc_tabbedPane);
|
|
|
|
JPanel panel_2 = new JPanel();
|
|
tabbedPane.addTab("Intervalle", null, panel_2, null);
|
|
GridBagLayout gbl_panel_2 = new GridBagLayout();
|
|
gbl_panel_2.columnWidths = new int[]{0, 0, 0};
|
|
gbl_panel_2.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0};
|
|
gbl_panel_2.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
|
|
gbl_panel_2.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
|
|
panel_2.setLayout(gbl_panel_2);
|
|
|
|
bfeIntervall = new BitFieldEditor();
|
|
bfeIntervall.setToolTipText(Messages.getString("tooltip.tagesbasierte.intervalle")); //"<html>\n<b>Tagesbasierte Intervalle</b><br/>\n<br/>\nTagesbasierte Intervalle werden immer auf 0:00:00 Uhr des aktuellen Tages bezogen ausgeführt.<br/>\nDies ermöglicht nicht nur eine Regelmäßige Aufzeichnung, sondern erzwingt auch eine Aufzeichnung<br/>\nin einem festgelegten immer gleichen Raster.<br/>\n<br/>\nNicht tageszeitbasierte Intervalle werden mit Bezug auf den 1.1.1970 0:00:00 Uhr ausgeführt.<br/>\nDiese ermöglichen eine stete regelmäßige Aufzeichnung bei der die tageszeit ignoriert wird.\n</html>");
|
|
bfeIntervall.addChangeListener(new ChangeListener() {
|
|
public void stateChanged(ChangeEvent e) {
|
|
int v = bfeIntervall.getIntValue();
|
|
tseI0.setDaysEnabled(((v & 0x01)==0));
|
|
tseI1.setDaysEnabled(((v & 0x02)==0));
|
|
tseI2.setDaysEnabled(((v & 0x04)==0));
|
|
tseI3.setDaysEnabled(((v & 0x08)==0));
|
|
}
|
|
});
|
|
|
|
JLabel lblTageszeitabhngigkeit = new JLabel(Messages.getString("Tageszeitabhängigkeit:"));
|
|
GridBagConstraints gbc_lblTageszeitabhngigkeit = new GridBagConstraints();
|
|
gbc_lblTageszeitabhngigkeit.fill = GridBagConstraints.HORIZONTAL;
|
|
gbc_lblTageszeitabhngigkeit.insets = new Insets(0, 0, 5, 5);
|
|
gbc_lblTageszeitabhngigkeit.gridx = 0;
|
|
gbc_lblTageszeitabhngigkeit.gridy = 0;
|
|
panel_2.add(lblTageszeitabhngigkeit, gbc_lblTageszeitabhngigkeit);
|
|
GridBagConstraints gbc_bfeIntervall = new GridBagConstraints();
|
|
gbc_bfeIntervall.anchor = GridBagConstraints.NORTH;
|
|
gbc_bfeIntervall.insets = new Insets(0, 0, 5, 0);
|
|
gbc_bfeIntervall.fill = GridBagConstraints.HORIZONTAL;
|
|
gbc_bfeIntervall.gridx = 1;
|
|
gbc_bfeIntervall.gridy = 0;
|
|
panel_2.add(bfeIntervall, gbc_bfeIntervall);
|
|
|
|
JLabel lblIntervall = new JLabel(Messages.getString("Intervall 0:"));
|
|
lblIntervall.setToolTipText(Messages.getString("tooltip.intervall")); // "<html>\n<b>Intervall</b><br/>\n<br/>\nStellen Sie die gewünschten Intervalllängen ein.<br/>\n<br/>\nEinheiten: <b>Tage, Stunden, Minuten, Sekunden</b>\n</html>");
|
|
GridBagConstraints gbc_lblIntervall = new GridBagConstraints();
|
|
gbc_lblIntervall.fill = GridBagConstraints.HORIZONTAL;
|
|
gbc_lblIntervall.insets = new Insets(0, 0, 5, 5);
|
|
gbc_lblIntervall.gridx = 0;
|
|
gbc_lblIntervall.gridy = 1;
|
|
panel_2.add(lblIntervall, gbc_lblIntervall);
|
|
|
|
tseI0 = new JTimeSpanEditor();
|
|
tseI0.setToolTipText(Messages.getString("tooltip.intervall"));
|
|
tseI0.addFocusListener(new FocusAdapter() {
|
|
@Override
|
|
public void focusLost(FocusEvent e) {
|
|
}
|
|
});
|
|
GridBagConstraints gbc_tseI0 = new GridBagConstraints();
|
|
gbc_tseI0.anchor = GridBagConstraints.WEST;
|
|
gbc_tseI0.insets = new Insets(0, 0, 5, 0);
|
|
gbc_tseI0.gridx = 1;
|
|
gbc_tseI0.gridy = 1;
|
|
panel_2.add(tseI0, gbc_tseI0);
|
|
|
|
JLabel lblIntervall_1 = new JLabel(Messages.getString("Intervall 1:"));
|
|
lblIntervall_1.setToolTipText(Messages.getString("tooltip.intervall"));
|
|
GridBagConstraints gbc_lblIntervall_1 = new GridBagConstraints();
|
|
gbc_lblIntervall_1.fill = GridBagConstraints.HORIZONTAL;
|
|
gbc_lblIntervall_1.insets = new Insets(0, 0, 5, 5);
|
|
gbc_lblIntervall_1.gridx = 0;
|
|
gbc_lblIntervall_1.gridy = 2;
|
|
panel_2.add(lblIntervall_1, gbc_lblIntervall_1);
|
|
|
|
tseI1 = new JTimeSpanEditor();
|
|
tseI1.setToolTipText(Messages.getString("tooltip.intervall"));
|
|
tseI1.addFocusListener(new FocusAdapter() {
|
|
@Override
|
|
public void focusLost(FocusEvent e) {
|
|
}
|
|
});
|
|
GridBagConstraints gbc_tseI1 = new GridBagConstraints();
|
|
gbc_tseI1.anchor = GridBagConstraints.WEST;
|
|
gbc_tseI1.insets = new Insets(0, 0, 5, 0);
|
|
gbc_tseI1.gridx = 1;
|
|
gbc_tseI1.gridy = 2;
|
|
panel_2.add(tseI1, gbc_tseI1);
|
|
|
|
JLabel lblIntervall_2 = new JLabel(Messages.getString("Intervall 2:"));
|
|
lblIntervall_2.setToolTipText(Messages.getString("tooltip.intervall"));
|
|
GridBagConstraints gbc_lblIntervall_2 = new GridBagConstraints();
|
|
gbc_lblIntervall_2.fill = GridBagConstraints.HORIZONTAL;
|
|
gbc_lblIntervall_2.insets = new Insets(0, 0, 5, 5);
|
|
gbc_lblIntervall_2.gridx = 0;
|
|
gbc_lblIntervall_2.gridy = 3;
|
|
panel_2.add(lblIntervall_2, gbc_lblIntervall_2);
|
|
|
|
tseI2 = new JTimeSpanEditor();
|
|
tseI2.setToolTipText(Messages.getString("tooltip.intervall"));
|
|
tseI2.addFocusListener(new FocusAdapter() {
|
|
@Override
|
|
public void focusLost(FocusEvent e) {
|
|
}
|
|
});
|
|
GridBagConstraints gbc_tseI2 = new GridBagConstraints();
|
|
gbc_tseI2.anchor = GridBagConstraints.WEST;
|
|
gbc_tseI2.insets = new Insets(0, 0, 5, 0);
|
|
gbc_tseI2.gridx = 1;
|
|
gbc_tseI2.gridy = 3;
|
|
panel_2.add(tseI2, gbc_tseI2);
|
|
|
|
JLabel lblIntervall_3 = new JLabel(Messages.getString("Intervall 3:"));
|
|
lblIntervall_3.setToolTipText(Messages.getString("tooltip.intervall"));
|
|
GridBagConstraints gbc_lblIntervall_3 = new GridBagConstraints();
|
|
gbc_lblIntervall_3.fill = GridBagConstraints.HORIZONTAL;
|
|
gbc_lblIntervall_3.insets = new Insets(0, 0, 5, 5);
|
|
gbc_lblIntervall_3.gridx = 0;
|
|
gbc_lblIntervall_3.gridy = 4;
|
|
panel_2.add(lblIntervall_3, gbc_lblIntervall_3);
|
|
|
|
tseI3 = new JTimeSpanEditor();
|
|
tseI3.setToolTipText(Messages.getString("tooltip.intervall"));
|
|
tseI3.addFocusListener(new FocusAdapter() {
|
|
@Override
|
|
public void focusLost(FocusEvent e) {
|
|
}
|
|
});
|
|
GridBagConstraints gbc_tseI3 = new GridBagConstraints();
|
|
gbc_tseI3.insets = new Insets(0, 0, 5, 0);
|
|
gbc_tseI3.anchor = GridBagConstraints.WEST;
|
|
gbc_tseI3.gridx = 1;
|
|
gbc_tseI3.gridy = 4;
|
|
panel_2.add(tseI3, gbc_tseI3);
|
|
|
|
JPanel panel_1 = new JPanel();
|
|
tabbedPane.addTab("Kanäle", null, panel_1, null);
|
|
GridBagLayout gbl_panel_1 = new GridBagLayout();
|
|
gbl_panel_1.columnWidths = new int[] {100};
|
|
gbl_panel_1.rowHeights = new int[] {30};
|
|
gbl_panel_1.columnWeights = new double[]{1.0};
|
|
gbl_panel_1.rowWeights = new double[]{1.0};
|
|
panel_1.setLayout(gbl_panel_1);
|
|
|
|
JScrollPane scrollPane = new JScrollPane();
|
|
GridBagConstraints gbc_scrollPane = new GridBagConstraints();
|
|
gbc_scrollPane.fill = GridBagConstraints.BOTH;
|
|
gbc_scrollPane.gridx = 0;
|
|
gbc_scrollPane.gridy = 0;
|
|
panel_1.add(scrollPane, gbc_scrollPane);
|
|
|
|
tSettings = new JTable();
|
|
tSettings.setRowHeight(32);
|
|
tSettings.setFillsViewportHeight(true);
|
|
tSettings.setCellSelectionEnabled(true);
|
|
scrollPane.setViewportView(tSettings);
|
|
|
|
pManagement = new JPanel();
|
|
tabbedPane.addTab("Speicherverwaltung", null, pManagement, null);
|
|
GridBagLayout gbl_pManagement = new GridBagLayout();
|
|
gbl_pManagement.columnWidths = new int[] {100};
|
|
gbl_pManagement.rowHeights = new int[]{25, 0, 0, 0, 0};
|
|
gbl_pManagement.columnWeights = new double[]{1.0};
|
|
gbl_pManagement.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
|
|
pManagement.setLayout(gbl_pManagement);
|
|
|
|
btnAlleZhlerLschen = new JButton(Messages.getString("Alle Zähler zurücksetzen"));
|
|
btnAlleZhlerLschen.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
resetCounters();
|
|
}
|
|
});
|
|
GridBagConstraints gbc_btnAlleZhlerLschen_1_1 = new GridBagConstraints();
|
|
gbc_btnAlleZhlerLschen_1_1.fill = GridBagConstraints.HORIZONTAL;
|
|
gbc_btnAlleZhlerLschen_1_1.gridx = 0;
|
|
gbc_btnAlleZhlerLschen_1_1.gridy = 0;
|
|
gbc_btnAlleZhlerLschen_1_1.insets = new Insets(0, 0, 5, 0);
|
|
pManagement.add(btnAlleZhlerLschen, gbc_btnAlleZhlerLschen_1_1);
|
|
|
|
JLabel lblNurNachRcksprache = new JLabel(Messages.getString("Nur nach Rücksprache mit Support:"));
|
|
GridBagConstraints gbc_lblNurNachRcksprache = new GridBagConstraints();
|
|
gbc_lblNurNachRcksprache.fill = GridBagConstraints.HORIZONTAL;
|
|
gbc_lblNurNachRcksprache.insets = new Insets(0, 0, 5, 0);
|
|
gbc_lblNurNachRcksprache.gridx = 0;
|
|
gbc_lblNurNachRcksprache.gridy = 1;
|
|
pManagement.add(lblNurNachRcksprache, gbc_lblNurNachRcksprache);
|
|
|
|
btnSnapshotSpeicherZurcksetzen = new JButton(Messages.getString("SnapShot Speicher zurücksetzen"));
|
|
btnSnapshotSpeicherZurcksetzen.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
resetSnapShots();
|
|
}
|
|
});
|
|
|
|
btnSnapshotSpeicherAuf = new JButton(Messages.getString("SnapShot Speicher auf letzten bekannten SnapShot setzen"));
|
|
btnSnapshotSpeicherAuf.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
resetSnapShots(true);
|
|
}
|
|
});
|
|
GridBagConstraints gbc_btnSnapshotSpeicherAuf_1_1 = new GridBagConstraints();
|
|
gbc_btnSnapshotSpeicherAuf_1_1.fill = GridBagConstraints.HORIZONTAL;
|
|
gbc_btnSnapshotSpeicherAuf_1_1.insets = new Insets(0, 0, 5, 0);
|
|
gbc_btnSnapshotSpeicherAuf_1_1.gridx = 0;
|
|
gbc_btnSnapshotSpeicherAuf_1_1.gridy = 2;
|
|
pManagement.add(btnSnapshotSpeicherAuf, gbc_btnSnapshotSpeicherAuf_1_1);
|
|
GridBagConstraints gbc_btnSnapshotSpeicherZurcksetzen_1_1 = new GridBagConstraints();
|
|
gbc_btnSnapshotSpeicherZurcksetzen_1_1.fill = GridBagConstraints.HORIZONTAL;
|
|
gbc_btnSnapshotSpeicherZurcksetzen_1_1.gridx = 0;
|
|
gbc_btnSnapshotSpeicherZurcksetzen_1_1.gridy = 3;
|
|
pManagement.add(btnSnapshotSpeicherZurcksetzen, gbc_btnSnapshotSpeicherZurcksetzen_1_1);
|
|
|
|
|
|
JButton btnSchliessen = new JButton(Messages.getString("Cancel"));
|
|
btnSchliessen.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
setVisible(false);
|
|
}
|
|
});
|
|
|
|
JButton btnOk = new JButton(Messages.getString("OK"));
|
|
btnOk.addActionListener(new ActionListener() {
|
|
public void actionPerformed(ActionEvent e) {
|
|
writeDevice();
|
|
setVisible(false);
|
|
}
|
|
});
|
|
GridBagConstraints gbc_btnOk = new GridBagConstraints();
|
|
gbc_btnOk.fill = GridBagConstraints.BOTH;
|
|
gbc_btnOk.insets = new Insets(0, 0, 0, 5);
|
|
gbc_btnOk.gridx = 1;
|
|
gbc_btnOk.gridy = 1;
|
|
contentPane.add(btnOk, gbc_btnOk);
|
|
GridBagConstraints gbc_btnSchliessen = new GridBagConstraints();
|
|
gbc_btnSchliessen.fill = GridBagConstraints.BOTH;
|
|
gbc_btnSchliessen.gridx = 2;
|
|
gbc_btnSchliessen.gridy = 1;
|
|
contentPane.add(btnSchliessen, gbc_btnSchliessen);
|
|
|
|
this.initialize();
|
|
}
|
|
|
|
private Integer intOr0(Integer i){
|
|
if (i==null)
|
|
return 0;
|
|
return i;
|
|
}
|
|
|
|
private void initialize(){
|
|
currentChannel = -1;
|
|
filter = new int[32];
|
|
windows = new int[32];
|
|
increments = new int[32];
|
|
|
|
tmSettings = new TableMapper(ChannelConfiguration.class, tSettings);
|
|
|
|
BitField bf = new BitField();
|
|
bf.clear();
|
|
bf.addField(new Field(bf, 0, 1, Messages.getString("Intervall 0 basiert auf Tageszeit")));
|
|
bf.addField(new Field(bf, 1, 1, Messages.getString("Intervall 1 basiert auf Tageszeit")));
|
|
bf.addField(new Field(bf, 2, 1, Messages.getString("Intervall 2 basiert auf Tageszeit")));
|
|
bf.addField(new Field(bf, 3, 1, Messages.getString("Intervall 3 basiert auf Tageszeit")));
|
|
bfeIntervall.setBitField(bf);
|
|
for (int i=0;i<32;i++){
|
|
tmSettings.addRow(new ChannelConfiguration(i));
|
|
}
|
|
|
|
|
|
readDevice();
|
|
}
|
|
|
|
private void resetSnapShots(){
|
|
resetSnapShots(false);
|
|
}
|
|
|
|
private void resetSnapShots(boolean toLastKnown){
|
|
if (JOptionPane.showConfirmDialog(null,
|
|
Messages.getString("<html>Diese Funktion sollte nur auf Aufforderung durch den Support ausgeführt werden.<br/>Soll der Snapshot Index auf dem Gerät wirklich zurückgesetzt werden?</html>"),
|
|
Messages.getString("Snapshot Index zurücksetzen"),
|
|
JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION){
|
|
deviceConnector.reset(toLastKnown ? PulsCounterApplication.getApplication().getDatabase().highestSnapShot(deviceConnector.getDeviceSerial()) : -1);
|
|
}
|
|
}
|
|
|
|
private void resetCounters(){
|
|
|
|
if (JOptionPane.showConfirmDialog(null,
|
|
Messages.getString("Wollen Sie wirklich alle Zählerstände auf 0 zurücksetzen?"),
|
|
Messages.getString("Alle Zählerstände zurücksetzen"),
|
|
JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION){
|
|
int[] zero = new int[32];
|
|
Arrays.fill(zero, 0);
|
|
deviceConnector.setCounters(zero);
|
|
}
|
|
}
|
|
|
|
private void readDevice(){
|
|
Integer v;
|
|
|
|
outputs = intOr0(deviceConnector.getConfigOutputs());
|
|
pullups = intOr0(deviceConnector.getConfigPullups());
|
|
inverts = intOr0(deviceConnector.getConfigInverts());
|
|
trigger = intOr0(deviceConnector.getConfigTriggers());
|
|
|
|
bfeIntervall.setIntValue(deviceConnector.getDailyBaseMask());
|
|
|
|
filter = deviceConnector.getDebounce();
|
|
windows = deviceConnector.getWindows();
|
|
increments = deviceConnector.getIncrements();
|
|
|
|
Integer iv0 = deviceConnector.getInterval(0);
|
|
tseI0.setValue( iv0 == 0 ? null : iv0 );
|
|
Integer iv1 = deviceConnector.getInterval(0);
|
|
tseI1.setValue( iv1 == 0 ? null : iv1 );
|
|
Integer iv2 = deviceConnector.getInterval(0);
|
|
tseI2.setValue( iv2 == 0 ? null : iv2 );
|
|
Integer iv3 = deviceConnector.getInterval(0);
|
|
tseI3.setValue( iv3 == 0 ? null : iv3 );
|
|
}
|
|
|
|
private void writeDevice(){
|
|
|
|
deviceConnector.setInterval(0, tseI0.getValue(), ((bfeIntervall.getIntValue() & (1<<0)) != 0) ? true : false);
|
|
deviceConnector.setInterval(1, tseI1.getValue(), ((bfeIntervall.getIntValue() & (1<<1)) != 0) ? true : false);
|
|
deviceConnector.setInterval(2, tseI2.getValue(), ((bfeIntervall.getIntValue() & (1<<2)) != 0) ? true : false);
|
|
deviceConnector.setInterval(3, tseI3.getValue(), ((bfeIntervall.getIntValue() & (1<<3)) != 0) ? true : false);
|
|
|
|
deviceConnector.setConfigOutputs(outputs);
|
|
deviceConnector.setConfigPullups(pullups);
|
|
deviceConnector.setConfigInverts(inverts);
|
|
deviceConnector.setConfigTriggers(trigger);
|
|
|
|
deviceConnector.setDebounce(filter);
|
|
deviceConnector.setWindows(windows);
|
|
deviceConnector.setIncrements(increments);
|
|
|
|
deviceConnector.syncConfigToLive();
|
|
}
|
|
|
|
class ChannelConfiguration{
|
|
|
|
int channel;
|
|
|
|
public ChannelConfiguration(int channel) {
|
|
this.channel = channel;
|
|
}
|
|
|
|
@TableColumn(label="Kanal",width=60,order=0,format="%02d")
|
|
public int getChannel(){
|
|
return channel;
|
|
}
|
|
|
|
@TableColumn(label="Ausgang",width=80,order=10)
|
|
public Boolean getOutput(){
|
|
return (outputs & 1<<channel) == 0 ? false : true;
|
|
}
|
|
public void setOutput(Boolean value){
|
|
outputs &= ~(1<<channel);
|
|
if (value){
|
|
outputs |= (1<<channel);
|
|
}
|
|
}
|
|
|
|
@TableColumn(label="Passiver Schalter",width=80,order=20)
|
|
public Boolean getPullup(){
|
|
return (pullups & 1<<channel) == 0 ? false : true;
|
|
}
|
|
public void setPullup(Boolean value){
|
|
pullups &= ~(1<<channel);
|
|
if (value){
|
|
pullups |= (1<<channel);
|
|
}
|
|
}
|
|
|
|
@TableColumn(label="Invertiert",width=80,order=30)
|
|
public Boolean getInvert(){
|
|
return (inverts & 1<<channel) == 0 ? false : true;
|
|
}
|
|
public void setInvert(Boolean value){
|
|
inverts &= ~(1<<channel);
|
|
if (value){
|
|
inverts |= (1<<channel);
|
|
}
|
|
}
|
|
|
|
@TableColumn(label="Löst Snapshot aus",width=80,order=40)
|
|
public Boolean getTrigger(){
|
|
return (trigger & 1<<channel) == 0 ? false : true;
|
|
}
|
|
public void setTrigger(Boolean value){
|
|
trigger &= ~(1<<channel);
|
|
if (value){
|
|
trigger |= (1<<channel);
|
|
}
|
|
}
|
|
|
|
@TableColumn(label="Signalfenster",width=80,order=200)
|
|
public Integer getWindow(){
|
|
return windows[channel];
|
|
}
|
|
public void setWindow(Integer value){
|
|
windows[channel] = value;
|
|
}
|
|
|
|
@TableColumn(label="Signalfilter",width=80,order=210)
|
|
public Integer getFilter(){
|
|
return filter[channel];
|
|
}
|
|
public void setFilter(Integer value){
|
|
filter[channel] = value;
|
|
}
|
|
|
|
@TableColumn(label="Inkrement",width=80,order=190)
|
|
public Integer getIncrement(){
|
|
return increments[channel];
|
|
}
|
|
public void setIncrement(Integer increment){
|
|
increments[channel] = increment;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|