org.hwo.pulscounter/src/org/hwo/pulscounter/ui/AppSettingsFrame.java

636 lines
20 KiB
Java

package org.hwo.pulscounter.ui;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.EventQueue;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Dialog.ModalExclusionType;
import javax.swing.JTabbedPane;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import javax.swing.JLabel;
import java.awt.Insets;
import javax.swing.JTextField;
import javax.swing.JButton;
import org.hwo.csv.CSV;
import org.hwo.io.SerialPort;
import org.hwo.io.NewSerialPort.NewSerialPort;
import org.hwo.pulscounter.PulsCounter2Application;
import org.hwo.pulscounter.SnapShot;
import org.hwo.pulscounter.SnapshotManager;
import org.hwo.servicelink.ServiceLink;
import org.hwo.servicelink.ServiceLinkException;
import org.hwo.servicelink.ServiceLinkRequestFailedException;
import org.hwo.ui.dialog.SerialPortChooser;
import java.awt.event.ActionListener;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Hashtable;
import java.util.Timer;
import java.util.TimerTask;
import java.awt.event.ActionEvent;
import java.awt.Dialog.ModalityType;
import javax.swing.border.TitledBorder;
import javax.swing.JSpinner;
import javax.swing.JEditorPane;
import javax.swing.JScrollPane;
public class AppSettingsFrame extends JDialog {
private JPanel contentPane;
private JTextField tfInterface;
private NewSerialPort selectedSerialPort,formerSerialPort;
private JTextField timeComputer;
private JTextField timeSynololog;
private JSpinner spTrimm;
private Timer timer;
private Calendar calendar = Calendar.getInstance();
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private JTabbedPane tabbedPane;
private JPanel debugPanel;
private JLabel lHeapDec;
private JLabel lHeapHex;
private JLabel lSStackDec;
private JLabel lSStackHex;
private JEditorPane msgExc;
/**
* Create the frame.
*/
public AppSettingsFrame() {
setModalityType(ModalityType.APPLICATION_MODAL);
setModal(true);
setTitle("Einstellungen");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 603, 447);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
contentPane.add(tabbedPane, BorderLayout.CENTER);
JPanel panel = new JPanel();
tabbedPane.addTab("Kommunikation", null, panel, null);
tabbedPane.setEnabledAt(0, true);
GridBagLayout gbl_panel = new GridBagLayout();
gbl_panel.columnWidths = new int[]{0, 0, 0, 0};
gbl_panel.rowHeights = new int[]{0, 0, 0, 0};
gbl_panel.columnWeights = new double[]{0.0, 1.0, 0.0, Double.MIN_VALUE};
gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
panel.setLayout(gbl_panel);
JLabel lblSchnittstelle = new JLabel("Schnittstelle:");
GridBagConstraints gbc_lblSchnittstelle = new GridBagConstraints();
gbc_lblSchnittstelle.anchor = GridBagConstraints.EAST;
gbc_lblSchnittstelle.insets = new Insets(0, 0, 5, 5);
gbc_lblSchnittstelle.gridx = 0;
gbc_lblSchnittstelle.gridy = 0;
panel.add(lblSchnittstelle, gbc_lblSchnittstelle);
tfInterface = new JTextField();
tfInterface.setToolTipText("<html>\n<b>Aktuell eingstellte Schnittstelle</b><br/>\n<br/>\nDiese Schnittstelle wird wür die Kommunikation mit dem Synololog verwendet.\n</html>");
GridBagConstraints gbc_tfInterface = new GridBagConstraints();
gbc_tfInterface.anchor = GridBagConstraints.NORTH;
gbc_tfInterface.insets = new Insets(0, 0, 5, 5);
gbc_tfInterface.fill = GridBagConstraints.HORIZONTAL;
gbc_tfInterface.gridx = 1;
gbc_tfInterface.gridy = 0;
panel.add(tfInterface, gbc_tfInterface);
tfInterface.setColumns(10);
JButton btnWhlen = new JButton("wählen...");
btnWhlen.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
chooseSerialPort();
}
});
GridBagConstraints gbc_btnWhlen = new GridBagConstraints();
gbc_btnWhlen.insets = new Insets(0, 0, 5, 0);
gbc_btnWhlen.gridx = 2;
gbc_btnWhlen.gridy = 0;
panel.add(btnWhlen, gbc_btnWhlen);
JPanel panel_3 = new JPanel();
tabbedPane.addTab("Inbetriebnahme", null, panel_3, null);
GridBagLayout gbl_panel_3 = new GridBagLayout();
gbl_panel_3.columnWidths = new int[]{0, 0};
gbl_panel_3.rowHeights = new int[]{0, 0};
gbl_panel_3.columnWeights = new double[]{1.0, Double.MIN_VALUE};
gbl_panel_3.rowWeights = new double[]{1.0, Double.MIN_VALUE};
panel_3.setLayout(gbl_panel_3);
JPanel panel_4 = new JPanel();
panel_4.setBorder(new TitledBorder(null, "Echtzeituhr", TitledBorder.LEADING, TitledBorder.TOP, null, null));
GridBagConstraints gbc_panel_4 = new GridBagConstraints();
gbc_panel_4.fill = GridBagConstraints.BOTH;
gbc_panel_4.gridx = 0;
gbc_panel_4.gridy = 0;
panel_3.add(panel_4, gbc_panel_4);
GridBagLayout gbl_panel_4 = new GridBagLayout();
gbl_panel_4.columnWidths = new int[]{0, 0, 0};
gbl_panel_4.rowHeights = new int[]{0, 0, 0, 0};
gbl_panel_4.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
gbl_panel_4.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
panel_4.setLayout(gbl_panel_4);
JLabel lblAktuelleUhrzeitcomputer = new JLabel("Aktuelle Uhrzeit (Computer):");
GridBagConstraints gbc_lblAktuelleUhrzeitcomputer = new GridBagConstraints();
gbc_lblAktuelleUhrzeitcomputer.anchor = GridBagConstraints.EAST;
gbc_lblAktuelleUhrzeitcomputer.insets = new Insets(0, 0, 5, 5);
gbc_lblAktuelleUhrzeitcomputer.gridx = 0;
gbc_lblAktuelleUhrzeitcomputer.gridy = 0;
panel_4.add(lblAktuelleUhrzeitcomputer, gbc_lblAktuelleUhrzeitcomputer);
timeComputer = new JTextField();
GridBagConstraints gbc_timeComputer = new GridBagConstraints();
gbc_timeComputer.insets = new Insets(0, 0, 5, 0);
gbc_timeComputer.fill = GridBagConstraints.HORIZONTAL;
gbc_timeComputer.gridx = 1;
gbc_timeComputer.gridy = 0;
panel_4.add(timeComputer, gbc_timeComputer);
timeComputer.setColumns(10);
JLabel lblAktuelleUhrzeitsynololog = new JLabel("Aktuelle Uhrzeit (Synololog):");
GridBagConstraints gbc_lblAktuelleUhrzeitsynololog = new GridBagConstraints();
gbc_lblAktuelleUhrzeitsynololog.anchor = GridBagConstraints.EAST;
gbc_lblAktuelleUhrzeitsynololog.insets = new Insets(0, 0, 5, 5);
gbc_lblAktuelleUhrzeitsynololog.gridx = 0;
gbc_lblAktuelleUhrzeitsynololog.gridy = 1;
panel_4.add(lblAktuelleUhrzeitsynololog, gbc_lblAktuelleUhrzeitsynololog);
timeSynololog = new JTextField();
GridBagConstraints gbc_timeSynololog = new GridBagConstraints();
gbc_timeSynololog.insets = new Insets(0, 0, 5, 0);
gbc_timeSynololog.fill = GridBagConstraints.HORIZONTAL;
gbc_timeSynololog.gridx = 1;
gbc_timeSynololog.gridy = 1;
panel_4.add(timeSynololog, gbc_timeSynololog);
timeSynololog.setColumns(10);
JLabel lblTrimmungsynololog = new JLabel("Trimmung (Synololog):");
GridBagConstraints gbc_lblTrimmungsynololog = new GridBagConstraints();
gbc_lblTrimmungsynololog.insets = new Insets(0, 0, 0, 5);
gbc_lblTrimmungsynololog.anchor = GridBagConstraints.EAST;
gbc_lblTrimmungsynololog.gridx = 0;
gbc_lblTrimmungsynololog.gridy = 2;
panel_4.add(lblTrimmungsynololog, gbc_lblTrimmungsynololog);
spTrimm = new JSpinner();
spTrimm.setToolTipText("<html>\n<b>Trimmung</b><br/>\n<br/>\nDieser Wert korrigiert die Echtzeituhr des Synololog.<br/>\nPositive Werte beschleunigen, negative Werte verlangsamen die Echtzeituhr des Synololog.<br/>\n<br/>\nEinheit: <b>us / 1004ms</b>\n</html>");
GridBagConstraints gbc_spTrimm = new GridBagConstraints();
gbc_spTrimm.fill = GridBagConstraints.HORIZONTAL;
gbc_spTrimm.gridx = 1;
gbc_spTrimm.gridy = 2;
panel_4.add(spTrimm, gbc_spTrimm);
debugPanel = new JPanel();
GridBagLayout gbl_debugPanel = new GridBagLayout();
gbl_debugPanel.columnWidths = new int[]{0, 0};
gbl_debugPanel.rowHeights = new int[]{0, 0, 0, 0};
gbl_debugPanel.columnWeights = new double[]{1.0, Double.MIN_VALUE};
gbl_debugPanel.rowWeights = new double[]{0.0, 0.0, 1.0, Double.MIN_VALUE};
debugPanel.setLayout(gbl_debugPanel);
JPanel panel_5 = new JPanel();
GridBagConstraints gbc_panel_5 = new GridBagConstraints();
gbc_panel_5.insets = new Insets(0, 0, 5, 0);
gbc_panel_5.fill = GridBagConstraints.BOTH;
gbc_panel_5.gridx = 0;
gbc_panel_5.gridy = 0;
debugPanel.add(panel_5, gbc_panel_5);
GridBagLayout gbl_panel_5 = new GridBagLayout();
gbl_panel_5.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
gbl_panel_5.rowHeights = new int[]{0, 0};
gbl_panel_5.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
gbl_panel_5.rowWeights = new double[]{0.0, Double.MIN_VALUE};
panel_5.setLayout(gbl_panel_5);
JButton btnUpdate = new JButton("Update...");
btnUpdate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
readDebug();
}
});
GridBagConstraints gbc_btnUpdate = new GridBagConstraints();
gbc_btnUpdate.insets = new Insets(0, 0, 0, 5);
gbc_btnUpdate.gridx = 0;
gbc_btnUpdate.gridy = 0;
panel_5.add(btnUpdate, gbc_btnUpdate);
JButton btnRamImage = new JButton("RAM Image...");
GridBagConstraints gbc_btnRamImage = new GridBagConstraints();
gbc_btnRamImage.insets = new Insets(0, 0, 0, 5);
gbc_btnRamImage.gridx = 1;
gbc_btnRamImage.gridy = 0;
panel_5.add(btnRamImage, gbc_btnRamImage);
JButton btnDumpSnapshots = new JButton("Dump Snapshots");
btnDumpSnapshots.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dumpSnapshots();
}
});
GridBagConstraints gbc_btnDumpSnapshots = new GridBagConstraints();
gbc_btnDumpSnapshots.insets = new Insets(0, 0, 0, 5);
gbc_btnDumpSnapshots.gridx = 2;
gbc_btnDumpSnapshots.gridy = 0;
panel_5.add(btnDumpSnapshots, gbc_btnDumpSnapshots);
JButton btnResetDevice = new JButton("Reset Device");
btnResetDevice.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doRESETDevice();
}
});
GridBagConstraints gbc_btnResetDevice = new GridBagConstraints();
gbc_btnResetDevice.insets = new Insets(0, 0, 0, 5);
gbc_btnResetDevice.gridx = 3;
gbc_btnResetDevice.gridy = 0;
panel_5.add(btnResetDevice, gbc_btnResetDevice);
JButton btnRckDump = new JButton("RCK Dump");
btnRckDump.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doRCKDump();
}
});
GridBagConstraints gbc_btnRckDump = new GridBagConstraints();
gbc_btnRckDump.gridx = 4;
gbc_btnRckDump.gridy = 0;
panel_5.add(btnRckDump, gbc_btnRckDump);
btnRamImage.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doRAMImage();
}
});
tabbedPane.addTab("DEBUG", null, debugPanel, null);
JPanel panel_2 = new JPanel();
panel_2.setBorder(new TitledBorder(null, "Live Stats", TitledBorder.LEADING, TitledBorder.TOP, null, null));
GridBagConstraints gbc_panel_2 = new GridBagConstraints();
gbc_panel_2.insets = new Insets(0, 0, 5, 0);
gbc_panel_2.fill = GridBagConstraints.BOTH;
gbc_panel_2.gridx = 0;
gbc_panel_2.gridy = 1;
debugPanel.add(panel_2, gbc_panel_2);
GridBagLayout gbl_panel_2 = new GridBagLayout();
gbl_panel_2.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
gbl_panel_2.rowHeights = new int[]{0, 0, 0};
gbl_panel_2.columnWeights = new double[]{0.0, 1.0, 1.0, 0.0, 0.0, Double.MIN_VALUE};
gbl_panel_2.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
panel_2.setLayout(gbl_panel_2);
JLabel lblHeapEnd = new JLabel("HEAP END:");
GridBagConstraints gbc_lblHeapEnd = new GridBagConstraints();
gbc_lblHeapEnd.anchor = GridBagConstraints.EAST;
gbc_lblHeapEnd.insets = new Insets(0, 0, 5, 5);
gbc_lblHeapEnd.gridx = 0;
gbc_lblHeapEnd.gridy = 0;
panel_2.add(lblHeapEnd, gbc_lblHeapEnd);
lHeapDec = new JLabel("Heap Dec");
GridBagConstraints gbc_lHeapDec = new GridBagConstraints();
gbc_lHeapDec.anchor = GridBagConstraints.EAST;
gbc_lHeapDec.insets = new Insets(0, 0, 5, 5);
gbc_lHeapDec.gridx = 1;
gbc_lHeapDec.gridy = 0;
panel_2.add(lHeapDec, gbc_lHeapDec);
lHeapHex = new JLabel("HeapHex");
GridBagConstraints gbc_lHeapHex = new GridBagConstraints();
gbc_lHeapHex.anchor = GridBagConstraints.EAST;
gbc_lHeapHex.insets = new Insets(0, 0, 5, 5);
gbc_lHeapHex.gridx = 2;
gbc_lHeapHex.gridy = 0;
panel_2.add(lHeapHex, gbc_lHeapHex);
JLabel lblSysStackBottom = new JLabel("SYS STACK BOTTOM:");
GridBagConstraints gbc_lblSysStackBottom = new GridBagConstraints();
gbc_lblSysStackBottom.anchor = GridBagConstraints.EAST;
gbc_lblSysStackBottom.insets = new Insets(0, 0, 0, 5);
gbc_lblSysStackBottom.gridx = 0;
gbc_lblSysStackBottom.gridy = 1;
panel_2.add(lblSysStackBottom, gbc_lblSysStackBottom);
lSStackDec = new JLabel("Stack Dec");
GridBagConstraints gbc_lSStackDec = new GridBagConstraints();
gbc_lSStackDec.anchor = GridBagConstraints.EAST;
gbc_lSStackDec.insets = new Insets(0, 0, 0, 5);
gbc_lSStackDec.gridx = 1;
gbc_lSStackDec.gridy = 1;
panel_2.add(lSStackDec, gbc_lSStackDec);
lSStackHex = new JLabel("StackHex");
GridBagConstraints gbc_lSStackHex = new GridBagConstraints();
gbc_lSStackHex.anchor = GridBagConstraints.EAST;
gbc_lSStackHex.insets = new Insets(0, 0, 0, 5);
gbc_lSStackHex.gridx = 2;
gbc_lSStackHex.gridy = 1;
panel_2.add(lSStackHex, gbc_lSStackHex);
JScrollPane scrollPane = new JScrollPane();
GridBagConstraints gbc_scrollPane = new GridBagConstraints();
gbc_scrollPane.fill = GridBagConstraints.BOTH;
gbc_scrollPane.gridx = 0;
gbc_scrollPane.gridy = 2;
debugPanel.add(scrollPane, gbc_scrollPane);
msgExc = new JEditorPane();
scrollPane.setViewportView(msgExc);
JPanel panel_1 = new JPanel();
contentPane.add(panel_1, BorderLayout.SOUTH);
GridBagLayout gbl_panel_1 = new GridBagLayout();
gbl_panel_1.columnWidths = new int[]{0, 0, 0};
gbl_panel_1.rowHeights = new int[]{0, 0};
gbl_panel_1.columnWeights = new double[]{1.0, 1.0, Double.MIN_VALUE};
gbl_panel_1.rowWeights = new double[]{0.0, Double.MIN_VALUE};
panel_1.setLayout(gbl_panel_1);
JButton bCANCEL = new JButton("cancel");
bCANCEL.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
});
GridBagConstraints gbc_bCANCEL = new GridBagConstraints();
gbc_bCANCEL.fill = GridBagConstraints.HORIZONTAL;
gbc_bCANCEL.insets = new Insets(0, 0, 0, 5);
gbc_bCANCEL.gridx = 0;
gbc_bCANCEL.gridy = 0;
panel_1.add(bCANCEL, gbc_bCANCEL);
JButton bOK = new JButton("OK");
bOK.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
accept();
setVisible(false);
application().savePrefs();
}
});
GridBagConstraints gbc_bOK = new GridBagConstraints();
gbc_bOK.fill = GridBagConstraints.HORIZONTAL;
gbc_bOK.gridx = 1;
gbc_bOK.gridy = 0;
panel_1.add(bOK, gbc_bOK);
initialize();
}
private void initialize(){
PulsCounter2Application pc2a = PulsCounter2Application.getApplication();
selectedSerialPort = pc2a.getSerialPort();
formerSerialPort = selectedSerialPort;
if (selectedSerialPort != null)
tfInterface.setText(selectedSerialPort.getPortName());
Integer trimmung = application().getServiceLink().getServiceRegisterCache().getCachedInteger(13, 0, 0x1002);
if (trimmung == null){
System.err.println("Trimmung konnte nicht gelesen werden!");
trimmung = 0;
spTrimm.setEnabled(false);
} else {
spTrimm.setValue(trimmung);
}
timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
Long deviceTimestamp;
Integer i;
i = application().getServiceLink().getServiceRegisterCache().getCachedInteger(13, 0, 0x001C);
if (i != null){
deviceTimestamp = new Long(i);
calendar.setTimeInMillis(deviceTimestamp * 1000L);
timeSynololog.setText( sdf.format( calendar.getTime() ));
timeComputer.setText(sdf.format(new Date()));
}
}
}, 500, 500);
for (int i=0;i<tabbedPane.getTabCount();i++){
Component c = tabbedPane.getComponentAt(i);
if (debugPanel.equals(c)){
tabbedPane.removeTabAt(i);
break;
}
}
}
public void debugging(){
tabbedPane.addTab("DEBUG", null, debugPanel, null);
}
private PulsCounter2Application application(){
return PulsCounter2Application.getApplication();
}
private void accept(){
try {
application().getServiceLink().writeInt(13, 0, 0x1002, (Integer)spTrimm.getValue());
} catch (ServiceLinkRequestFailedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ServiceLinkException e) {
e.printStackTrace();
}
if (formerSerialPort != selectedSerialPort){
application().setSerialPort(selectedSerialPort);
}
}
private void chooseSerialPort(){
PulsCounter2Application pc2a = PulsCounter2Application.getApplication();
SerialPortChooser spc = new SerialPortChooser();
String selectedPortName = null;
if (selectedSerialPort != null)
selectedPortName = selectedSerialPort.getPortName();
NewSerialPort sp = spc.execute(selectedPortName);
if (sp != null){
selectedSerialPort = sp;
tfInterface.setText(sp.getPortName());
};
}
private void doRESETDevice(){
PulsCounter2Application pc2a = PulsCounter2Application.getApplication();
ServiceLink sl = pc2a.getServiceLink();
try {
sl.open();
sl.writeInt(13, 0, 0x1001, 3);
} catch (Exception e){
e.printStackTrace();
}
}
private void doRAMImage(){
PulsCounter2Application pc2a = PulsCounter2Application.getApplication();
ServiceLink sl = pc2a.getServiceLink();
try {
sl.open();
sl.writeInt(13, 0, 0x0004, 0xFF00A3);
Integer sp = sl.getServiceRegisterCache().getCachedInteger(13, 0, 0x0004);
System.err.println(String.format("SP readback: 0x%08x",sp));
File dump = new File("ram.bin");
FileOutputStream o = new FileOutputStream(dump);
for (int p=0;p<0x2100;p++){
if (p % 0x0010 == 0){
System.err.println(String.format("P: 0x%04x",p));
}
try {
Thread.sleep(2);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
sl.writeInt(13, 0, 0x00eb, (p));
try {
Thread.sleep(2);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Integer i32 = sl.readInt(13, 0, 0x00ee);
o.write(i32 & 0xff);
/* o.write((i32>>8) & 0xff);
o.write((i32>>16) & 0xff);
o.write((i32>>24) & 0xff);
*/
}
o.close();
} catch (ServiceLinkRequestFailedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ServiceLinkException e) {
e.printStackTrace();
}
}
void readDebug(){
Integer v;
PulsCounter2Application pc2a = PulsCounter2Application.getApplication();
ServiceLink sl = pc2a.getServiceLink();
try {
v = sl.getServiceRegisterCache().getCachedInteger(13, 0, 0x0020);
if (v != null){
lHeapDec.setText(v.toString());
lHeapHex.setText(Integer.toHexString(v));
}
v = sl.getServiceRegisterCache().getCachedInteger(13, 0, 0x0021);
if (v != null){
lSStackDec.setText(v.toString());
lSStackHex.setText(Integer.toHexString(v));
}
} catch (Exception e){
StringBuilder sb = new StringBuilder();
ByteArrayOutputStream out = new ByteArrayOutputStream();
sb.append(e.toString());
e.printStackTrace(new PrintStream(out));
sb.append("\n");
sb.append(out.toString());
msgExc.setText(sb.toString());
}
}
void dumpSnapshots(){
SnapshotManager ssm = PulsCounter2Application.getApplication().getSnapshotManager();
for (int n=0;n<ssm.size();n++){
SnapShot ss = ssm.loadSnapShot(n);
System.err.println(ss.toString());
}
}
void doRCKDump(){
StringBuilder sb = new StringBuilder();
ServiceLink sl = application().getServiceLink();
sb.append("Dumpink RCK EEPROM:\n");
for (int i=0x0004000;i<0x0005000;i+=4){
try {
sl.writeInt(13, 0, 0x9010, i);
} catch (Exception e){
sb.append(String.format("0x%08x failed [index] (%s).\n",i,e.toString()));
}
try {
Integer v = sl.readInt(13, 0, 0x9011);
sb.append(String.format("0x%08x: 0x%08x\n",i,v));
} catch (Exception e){
sb.append(String.format("0x%08x failed [read] (%s).\n",i,e.toString()));
}
}
msgExc.setText(sb.toString());
}
}