started adding autoconnect and ecu init to logger

git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@393 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
kascade 2006-12-23 23:08:13 +00:00
parent 19ebcbd234
commit 7291f0d5d4
66 changed files with 888 additions and 199 deletions

View File

@ -38,13 +38,12 @@ import enginuity.xml.DOMRomUnmarshaller;
import enginuity.xml.DOMSettingsBuilder; import enginuity.xml.DOMSettingsBuilder;
import enginuity.xml.DOMSettingsUnmarshaller; import enginuity.xml.DOMSettingsUnmarshaller;
import enginuity.xml.RomNotFoundException; import enginuity.xml.RomNotFoundException;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import javax.swing.*;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
@ -58,17 +57,6 @@ import java.io.FileInputStream;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.util.Vector; import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.UIManager;
import javax.swing.tree.TreePath;
public class ECUEditor extends JFrame implements WindowListener, PropertyChangeListener { public class ECUEditor extends JFrame implements WindowListener, PropertyChangeListener {

View File

@ -26,5 +26,5 @@ public interface EcuConnection {
byte[] send(byte[] bytes); byte[] send(byte[] bytes);
void close(); void close();
} }

View File

@ -128,7 +128,6 @@ public final class SerialConnectionImpl implements SerialConnection {
} }
} }
private SerialPort connect(ConnectionProperties connectionProperties, String portName) { private SerialPort connect(ConnectionProperties connectionProperties, String portName) {
CommPortIdentifier portIdentifier = resolvePortIdentifier(portName); CommPortIdentifier portIdentifier = resolvePortIdentifier(portName);
SerialPort serialPort = openPort(portIdentifier, connectionProperties.getConnectTimeout()); SerialPort serialPort = openPort(portIdentifier, connectionProperties.getConnectTimeout());

View File

@ -21,28 +21,40 @@
package enginuity.io.port; package enginuity.io.port;
import enginuity.logger.comms.controller.LoggerController;
import static enginuity.util.ParamChecker.checkNotNull; import static enginuity.util.ParamChecker.checkNotNull;
import enginuity.util.ThreadUtil;
import gnu.io.CommPortIdentifier;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
public final class SerialPortRefresher implements Runnable { public final class SerialPortRefresher implements Runnable {
private static final long PORT_REFRESH_INTERVAL = 15000L;
private final SerialPortDiscoverer serialPortDiscoverer = new SerialPortDiscovererImpl();
private SerialPortRefreshListener listener; private SerialPortRefreshListener listener;
private LoggerController controller;
public SerialPortRefresher(SerialPortRefreshListener listener, LoggerController controller) { public SerialPortRefresher(SerialPortRefreshListener listener) {
checkNotNull(listener, controller); checkNotNull(listener);
this.listener = listener; this.listener = listener;
this.controller = controller;
} }
public void run() { public void run() {
while (true) { while (true) {
listener.refreshPortList(controller.listSerialPorts()); listener.refreshPortList(listSerialPorts());
try { ThreadUtil.sleep(PORT_REFRESH_INTERVAL);
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
break;
}
} }
} }
private Set<String> listSerialPorts() {
List<CommPortIdentifier> portIdentifiers = serialPortDiscoverer.listPorts();
Set<String> portNames = new TreeSet<String>();
for (CommPortIdentifier portIdentifier : portIdentifiers) {
String portName = portIdentifier.getName();
if (!portNames.contains(portName)) {
portNames.add(portName);
}
}
return portNames;
}
} }

View File

@ -33,6 +33,8 @@ public interface Protocol {
byte calculateChecksum(byte[] bytes); byte calculateChecksum(byte[] bytes);
boolean isValidEcuInitResponse(byte[] bytes);
ConnectionProperties getConnectionProperties(); ConnectionProperties getConnectionProperties();
} }

View File

@ -0,0 +1,44 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.io.protocol;
import enginuity.logger.exception.UnsupportedProtocolException;
public final class ProtocolFactory {
private static final ProtocolFactory INSTANCE = new ProtocolFactory();
public static ProtocolFactory getInstance() {
return INSTANCE;
}
private ProtocolFactory() {
}
public Protocol getProtocol(String protocolName) {
try {
Class<?> cls = Class.forName(this.getClass().getPackage().getName() + "." + protocolName + "Protocol");
return (Protocol) cls.newInstance();
} catch (Exception e) {
throw new UnsupportedProtocolException("'" + protocolName + "' is not a supported protocol", e);
}
}
}

View File

@ -70,6 +70,11 @@ public final class SSMProtocol implements Protocol {
return asByte(total - ((total >>> 16) << 16)); return asByte(total - ((total >>> 16) << 16));
} }
public boolean isValidEcuInitResponse(byte[] bytes) {
//TODO: Implement this!!
return bytes != null && bytes.length > 0;
}
public ConnectionProperties getConnectionProperties() { public ConnectionProperties getConnectionProperties() {
return new ConnectionProperties() { return new ConnectionProperties() {

View File

@ -25,6 +25,7 @@ import enginuity.Settings;
import enginuity.io.port.SerialPortRefresher; import enginuity.io.port.SerialPortRefresher;
import enginuity.logger.comms.controller.LoggerController; import enginuity.logger.comms.controller.LoggerController;
import enginuity.logger.comms.controller.LoggerControllerImpl; import enginuity.logger.comms.controller.LoggerControllerImpl;
import enginuity.logger.comms.query.LoggerCallback;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;
import enginuity.logger.definition.EcuDataLoader; import enginuity.logger.definition.EcuDataLoader;
import enginuity.logger.definition.EcuDataLoaderImpl; import enginuity.logger.definition.EcuDataLoaderImpl;
@ -36,7 +37,6 @@ import enginuity.logger.profile.UserProfileItem;
import enginuity.logger.profile.UserProfileItemImpl; import enginuity.logger.profile.UserProfileItemImpl;
import enginuity.logger.profile.UserProfileLoader; import enginuity.logger.profile.UserProfileLoader;
import enginuity.logger.profile.UserProfileLoaderImpl; import enginuity.logger.profile.UserProfileLoaderImpl;
import enginuity.logger.ui.ControllerButton;
import enginuity.logger.ui.DataRegistrationBroker; import enginuity.logger.ui.DataRegistrationBroker;
import enginuity.logger.ui.DataRegistrationBrokerImpl; import enginuity.logger.ui.DataRegistrationBrokerImpl;
import enginuity.logger.ui.EcuDataComparator; import enginuity.logger.ui.EcuDataComparator;
@ -57,11 +57,11 @@ import enginuity.logger.ui.handler.table.TableUpdateHandler;
import enginuity.logger.ui.paramlist.ParameterListTable; import enginuity.logger.ui.paramlist.ParameterListTable;
import enginuity.logger.ui.paramlist.ParameterListTableModel; import enginuity.logger.ui.paramlist.ParameterListTableModel;
import enginuity.logger.ui.paramlist.ParameterRow; import enginuity.logger.ui.paramlist.ParameterRow;
import static enginuity.util.HexUtil.asHex;
import static enginuity.util.ParamChecker.checkNotNull; import static enginuity.util.ParamChecker.checkNotNull;
import enginuity.util.ThreadUtil;
import javax.swing.*; import javax.swing.*;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.showMessageDialog;
import static javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED; import static javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;
import static javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER; import static javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER;
import static javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED; import static javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED;
@ -90,11 +90,13 @@ import java.util.Map;
/* /*
TODO: add better debug logging, preferably to a file and switchable (on/off) TODO: add better debug logging, preferably to a file and switchable (on/off)
TODO: finish dashboard tab
TODO: add configuration screen (log file destination, etc)
TODO: add user definable addresses TODO: add user definable addresses
TODO: Clean up this class! TODO: Clean up this class!
So much to do, so little time.... So much to do, so little time....
Autoconnect Stuff:
TODO: Add reconnect/refresh connection button/menu item.
TODO: Finish ecu init callback - parse it, etc
*/ */
public final class EcuLogger extends JFrame implements WindowListener, PropertyChangeListener, MessageListener { public final class EcuLogger extends JFrame implements WindowListener, PropertyChangeListener, MessageListener {
@ -134,12 +136,21 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
initUserInterface(); initUserInterface();
initDataUpdateHandlers(); initDataUpdateHandlers();
reloadUserProfile(settings.getLoggerProfileFilePath()); reloadUserProfile(settings.getLoggerProfileFilePath());
restartLogging();
} }
private void bootstrap(Settings settings) { private void bootstrap(Settings settings) {
checkNotNull(settings); checkNotNull(settings);
this.settings = settings; this.settings = settings;
controller = new LoggerControllerImpl(settings, this);
// TODO: Do something useful with this!!
LoggerCallback ecuInitCallback = new LoggerCallback() {
public void callback(byte[] value) {
System.out.println("Ecu Init response = " + asHex(value));
}
};
controller = new LoggerControllerImpl(settings, ecuInitCallback, this);
statusBarLabel = new JLabel(ENGINUITY_ECU_LOGGER_TITLE); statusBarLabel = new JLabel(ENGINUITY_ECU_LOGGER_TITLE);
tabbedPane = new JTabbedPane(BOTTOM); tabbedPane = new JTabbedPane(BOTTOM);
portsComboBox = new SerialPortComboBox(settings); portsComboBox = new SerialPortComboBox(settings);
@ -171,7 +182,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
} }
private void startPortRefresherThread() { private void startPortRefresherThread() {
Thread portRefresherThread = new Thread(new SerialPortRefresher(portsComboBox, controller)); Thread portRefresherThread = new Thread(new SerialPortRefresher(portsComboBox));
portRefresherThread.setDaemon(true); portRefresherThread.setDaemon(true);
portRefresherThread.start(); portRefresherThread.start();
} }
@ -236,14 +247,12 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
} }
private void clearParamTableModels() { private void clearParamTableModels() {
stopLogging();
dataTabParamListTableModel.clear(); dataTabParamListTableModel.clear();
graphTabParamListTableModel.clear(); graphTabParamListTableModel.clear();
dashboardTabParamListTableModel.clear(); dashboardTabParamListTableModel.clear();
} }
private void clearSwitchTableModels() { private void clearSwitchTableModels() {
stopLogging();
dataTabSwitchListTableModel.clear(); dataTabSwitchListTableModel.clear();
graphTabSwitchListTableModel.clear(); graphTabSwitchListTableModel.clear();
dashboardTabSwitchListTableModel.clear(); dashboardTabSwitchListTableModel.clear();
@ -395,7 +404,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
private JPanel buildControlToolbar() { private JPanel buildControlToolbar() {
JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 50, 0)); JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 50, 0));
controlPanel.add(buildPortsComboBox()); controlPanel.add(buildPortsComboBox());
controlPanel.add(buildStartStopButtons()); controlPanel.add(buildReconnectButton());
controlPanel.add(buildStatusIndicator()); controlPanel.add(buildStatusIndicator());
return controlPanel; return controlPanel;
} }
@ -404,7 +413,6 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
portsComboBox.addActionListener(new ActionListener() { portsComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) { public void actionPerformed(ActionEvent actionEvent) {
settings.setLoggerPort((String) portsComboBox.getSelectedItem()); settings.setLoggerPort((String) portsComboBox.getSelectedItem());
stopLogging();
} }
}); });
JPanel comboBoxPanel = new JPanel(new FlowLayout()); JPanel comboBoxPanel = new JPanel(new FlowLayout());
@ -413,33 +421,19 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
return comboBoxPanel; return comboBoxPanel;
} }
private JPanel buildStartStopButtons() { private JButton buildReconnectButton() {
JPanel buttonPanel = new JPanel(new FlowLayout()); JButton reconnectButton = new JButton("Reconnect");
buttonPanel.add(buildStartButton()); reconnectButton.addActionListener(new ActionListener() {
buttonPanel.add(buildStopButton());
return buttonPanel;
}
private ControllerButton buildStartButton() {
ControllerButton startButton = new ControllerButton("Start", true);
startButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) { public void actionPerformed(ActionEvent actionEvent) {
startLogging(); restartLogging();
} }
}); });
controller.addListener(startButton); return reconnectButton;
return startButton;
} }
private ControllerButton buildStopButton() { public void restartLogging() {
ControllerButton stopButton = new ControllerButton("Stop", false); stopLogging();
stopButton.addActionListener(new ActionListener() { startLogging();
public void actionPerformed(ActionEvent actionEvent) {
stopLogging();
}
});
controller.addListener(stopButton);
return stopButton;
} }
private StatusIndicator buildStatusIndicator() { private StatusIndicator buildStatusIndicator() {
@ -486,10 +480,6 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
public void propertyChange(PropertyChangeEvent propertyChangeEvent) { public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
} }
public void loadProfile(File profileFile) {
//TODO: Finish profile loading from file!!
}
public void startLogging() { public void startLogging() {
settings.setLoggerPort((String) portsComboBox.getSelectedItem()); settings.setLoggerPort((String) portsComboBox.getSelectedItem());
controller.start(); controller.start();
@ -497,17 +487,13 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
public void stopLogging() { public void stopLogging() {
controller.stop(); controller.stop();
ThreadUtil.sleep(1000L);
} }
public void handleExit() { public void handleExit() {
try { try {
try { try {
stopLogging(); stopLogging();
try {
Thread.sleep(250);
} catch (InterruptedException e) {
e.printStackTrace();
}
} finally { } finally {
cleanUpUpdateHandlers(); cleanUpUpdateHandlers();
} }
@ -542,7 +528,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
public void reportError(String error) { public void reportError(String error) {
if (error != null) { if (error != null) {
showMessageDialog(null, error, "Alert", ERROR_MESSAGE); statusBarLabel.setText("Error: " + error);
} }
} }

View File

@ -25,12 +25,8 @@ import enginuity.logger.comms.query.LoggerCallback;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;
import enginuity.logger.ui.ControllerListener; import enginuity.logger.ui.ControllerListener;
import java.util.Set;
public interface LoggerController { public interface LoggerController {
Set<String> listSerialPorts();
void addLogger(String callerId, EcuData ecuData, LoggerCallback callback); void addLogger(String callerId, EcuData ecuData, LoggerCallback callback);
void removeLogger(String callerId, EcuData ecuData); void removeLogger(String callerId, EcuData ecuData);
@ -40,4 +36,5 @@ public interface LoggerController {
void stop(); void stop();
void addListener(ControllerListener listener); void addListener(ControllerListener listener);
} }

View File

@ -22,46 +22,26 @@
package enginuity.logger.comms.controller; package enginuity.logger.comms.controller;
import enginuity.Settings; import enginuity.Settings;
import enginuity.io.port.SerialPortDiscoverer;
import enginuity.io.port.SerialPortDiscovererImpl;
import enginuity.logger.comms.manager.QueryManager; import enginuity.logger.comms.manager.QueryManager;
import enginuity.logger.comms.manager.QueryManagerImpl; import enginuity.logger.comms.manager.QueryManagerImpl;
import enginuity.logger.comms.manager.TransmissionManager;
import enginuity.logger.comms.manager.TransmissionManagerImpl;
import enginuity.logger.comms.query.LoggerCallback; import enginuity.logger.comms.query.LoggerCallback;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;
import enginuity.logger.ui.ControllerListener; import enginuity.logger.ui.ControllerListener;
import enginuity.logger.ui.MessageListener; import enginuity.logger.ui.MessageListener;
import static enginuity.util.ParamChecker.checkNotNull; import static enginuity.util.ParamChecker.checkNotNull;
import gnu.io.CommPortIdentifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import static java.util.Collections.synchronizedList;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.TreeSet;
public final class LoggerControllerImpl implements LoggerController { public final class LoggerControllerImpl implements LoggerController {
private final QueryManager queryManager; private final QueryManager queryManager;
private final List<ControllerListener> listeners = Collections.synchronizedList(new ArrayList<ControllerListener>()); private final List<ControllerListener> listeners = synchronizedList(new ArrayList<ControllerListener>());
private boolean started = false; private boolean started = false;
public LoggerControllerImpl(Settings settings, MessageListener messageListener) { public LoggerControllerImpl(Settings settings, LoggerCallback ecuInitCallback, MessageListener messageListener) {
TransmissionManager txManager = new TransmissionManagerImpl(settings); checkNotNull(settings, ecuInitCallback, messageListener);
queryManager = new QueryManagerImpl(this, txManager, messageListener); queryManager = new QueryManagerImpl(this, settings, ecuInitCallback, messageListener);
}
public Set<String> listSerialPorts() {
SerialPortDiscoverer serialPortDiscoverer = new SerialPortDiscovererImpl();
List<CommPortIdentifier> portIdentifiers = serialPortDiscoverer.listPorts();
Set<String> portNames = new TreeSet<String>();
for (CommPortIdentifier portIdentifier : portIdentifiers) {
String portName = portIdentifier.getName();
if (!portNames.contains(portName)) {
portNames.add(portName);
}
}
return portNames;
} }
public synchronized void addListener(ControllerListener listener) { public synchronized void addListener(ControllerListener listener) {
@ -86,15 +66,17 @@ public final class LoggerControllerImpl implements LoggerController {
Thread queryManagerThread = new Thread(queryManager); Thread queryManagerThread = new Thread(queryManager);
queryManagerThread.setDaemon(true); queryManagerThread.setDaemon(true);
queryManagerThread.start(); queryManagerThread.start();
startListeners();
started = true; started = true;
startListeners();
} }
} }
public synchronized void stop() { public synchronized void stop() {
stopListeners(); if (started) {
queryManager.stop(); queryManager.stop();
started = false; started = false;
stopListeners();
}
} }
private void startListeners() { private void startListeners() {

View File

@ -21,6 +21,11 @@
package enginuity.logger.comms.manager; package enginuity.logger.comms.manager;
import enginuity.Settings;
import enginuity.io.connection.EcuConnection;
import enginuity.io.connection.EcuConnectionImpl;
import enginuity.io.protocol.Protocol;
import enginuity.io.protocol.ProtocolFactory;
import enginuity.logger.comms.controller.LoggerController; import enginuity.logger.comms.controller.LoggerController;
import enginuity.logger.comms.query.LoggerCallback; import enginuity.logger.comms.query.LoggerCallback;
import enginuity.logger.comms.query.RegisteredQuery; import enginuity.logger.comms.query.RegisteredQuery;
@ -28,6 +33,7 @@ import enginuity.logger.comms.query.RegisteredQueryImpl;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;
import enginuity.logger.ui.MessageListener; import enginuity.logger.ui.MessageListener;
import static enginuity.util.ParamChecker.checkNotNull; import static enginuity.util.ParamChecker.checkNotNull;
import enginuity.util.ThreadUtil;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -36,47 +42,89 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@SuppressWarnings({"FieldCanBeLocal"})
public final class QueryManagerImpl implements QueryManager { public final class QueryManagerImpl implements QueryManager {
private final DecimalFormat format = new DecimalFormat("0.00"); private final DecimalFormat format = new DecimalFormat("0.00");
private final Map<String, RegisteredQuery> queryMap = Collections.synchronizedMap(new HashMap<String, RegisteredQuery>()); private final Map<String, RegisteredQuery> queryMap = Collections.synchronizedMap(new HashMap<String, RegisteredQuery>());
private final Map<String, RegisteredQuery> addList = new HashMap<String, RegisteredQuery>(); private final Map<String, RegisteredQuery> addList = new HashMap<String, RegisteredQuery>();
private final List<String> removeList = new ArrayList<String>(); private final List<String> removeList = new ArrayList<String>();
private final TransmissionManager txManager;
private final MessageListener messageListener;
private final LoggerController controller; private final LoggerController controller;
private final Settings settings;
private final LoggerCallback ecuInitCallback;
private final MessageListener messageListener;
private boolean stop = false; private boolean stop = false;
private Thread queryManagerThread = null;
public QueryManagerImpl(LoggerController controller, TransmissionManager txManager, MessageListener messageListener) { public QueryManagerImpl(LoggerController controller, Settings settings, LoggerCallback ecuInitCallback, MessageListener messageListener) {
checkNotNull(controller, txManager, messageListener); checkNotNull(controller, settings, ecuInitCallback, messageListener);
this.controller = controller; this.controller = controller;
this.txManager = txManager; this.settings = settings;
this.ecuInitCallback = ecuInitCallback;
this.messageListener = messageListener; this.messageListener = messageListener;
} }
public synchronized void addQuery(String callerId, EcuData ecuData, LoggerCallback callback) { public synchronized void addQuery(String callerId, EcuData ecuData, LoggerCallback callback) {
checkNotNull(ecuData, callback); checkNotNull(callerId, ecuData, callback);
addList.put(buildQueryId(callerId, ecuData), new RegisteredQueryImpl(ecuData, callback)); addList.put(buildQueryId(callerId, ecuData), new RegisteredQueryImpl(ecuData, callback));
} }
public synchronized void removeQuery(String callerId, EcuData ecuData) { public synchronized void removeQuery(String callerId, EcuData ecuData) {
checkNotNull(callerId, ecuData);
removeList.add(buildQueryId(callerId, ecuData)); removeList.add(buildQueryId(callerId, ecuData));
} }
public void run() { public void run() {
queryManagerThread = Thread.currentThread();
System.out.println("QueryManager started."); System.out.println("QueryManager started.");
stop = false;
while (!stop) {
if (doEcuInit()) {
runLogger();
} else {
ThreadUtil.sleep(5000L);
}
}
System.out.println("QueryManager stopped.");
}
private boolean doEcuInit() {
Protocol protocol = ProtocolFactory.getInstance().getProtocol(settings.getLoggerProtocol());
EcuConnection ecuConnection = new EcuConnectionImpl(protocol.getConnectionProperties(), settings.getLoggerPort());
try {
messageListener.reportMessage("Sending ECU Init...");
byte[] response = ecuConnection.send(protocol.constructEcuInitRequest());
if (protocol.isValidEcuInitResponse(response)) {
ecuInitCallback.callback(response);
messageListener.reportMessage("Sending ECU Init...done.");
return true;
} else {
messageListener.reportMessage("Waiting for ECU connection...");
return false;
}
} catch (Exception e) {
messageListener.reportMessage("Error sending ECU init - check correct serial port has been selected.");
e.printStackTrace();
return false;
} finally {
ecuConnection.close();
}
}
private void runLogger() {
TransmissionManager txManager = new TransmissionManagerImpl(settings);
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
int count = 0; int count = 0;
try { try {
txManager.start(); txManager.start();
stop = false;
while (!stop) { while (!stop) {
updateQueryList(); updateQueryList();
txManager.sendQueries(queryMap.values()); if (queryMap.isEmpty()) {
count++; messageListener.reportMessage("Select parameters to be logged...");
messageListener.reportMessage(buildStatsMessage(start, count)); ThreadUtil.sleep(2000L);
} else {
txManager.sendQueries(queryMap.values());
count++;
messageListener.reportMessage(buildStatsMessage(start, count));
}
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -84,13 +132,14 @@ public final class QueryManagerImpl implements QueryManager {
messageListener.reportError(e); messageListener.reportError(e);
} finally { } finally {
txManager.stop(); txManager.stop();
messageListener.reportMessage("Logging stopped.");
} }
System.out.println("QueryManager stopped.");
} }
public void stop() { public void stop() {
stop = true; stop = true;
if (queryManagerThread != null) {
queryManagerThread.interrupt();
}
} }
private String buildQueryId(String callerId, EcuData ecuData) { private String buildQueryId(String callerId, EcuData ecuData) {

View File

@ -1,22 +0,0 @@
package enginuity.logger.ui;
import javax.swing.*;
public final class ControllerButton extends JButton implements ControllerListener {
private final boolean enabledOnInit;
public ControllerButton(String string, boolean enabledOnInit) {
super(string);
this.enabledOnInit = enabledOnInit;
setEnabled(enabledOnInit);
}
public void start() {
setEnabled(!enabledOnInit);
}
public void stop() {
setEnabled(enabledOnInit);
}
}

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui; package enginuity.logger.ui;
public interface ControllerListener { public interface ControllerListener {

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui; package enginuity.logger.ui;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui; package enginuity.logger.ui;
import enginuity.logger.comms.controller.LoggerController; import enginuity.logger.comms.controller.LoggerController;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui; package enginuity.logger.ui;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui; package enginuity.logger.ui;
import enginuity.logger.EcuLogger; import enginuity.logger.EcuLogger;
@ -26,6 +47,9 @@ public class EcuLoggerMenuBar extends JMenuBar implements ActionListener {
private JMenuItem profileManager = new JMenuItem("Profile Manager"); private JMenuItem profileManager = new JMenuItem("Profile Manager");
private JMenuItem logFileLocation = new JMenuItem("Log File Output Location..."); private JMenuItem logFileLocation = new JMenuItem("Log File Output Location...");
private JMenu connectionMenu = new JMenu("Connection");
private JMenuItem reconnect = new JMenuItem("Reconnect...");
private JMenu helpMenu = new JMenu("Help"); private JMenu helpMenu = new JMenu("Help");
private JMenuItem about = new JMenuItem("About Enginuity ECU Logger"); private JMenuItem about = new JMenuItem("About Enginuity ECU Logger");
@ -62,6 +86,13 @@ public class EcuLoggerMenuBar extends JMenuBar implements ActionListener {
profileManager.addActionListener(this); profileManager.addActionListener(this);
logFileLocation.addActionListener(this); logFileLocation.addActionListener(this);
// connection menu items
add(connectionMenu);
connectionMenu.setMnemonic('C');
reconnect.setMnemonic('R');
connectionMenu.add(reconnect);
reconnect.addActionListener(this);
// help menu stuff // help menu stuff
add(helpMenu); add(helpMenu);
helpMenu.setMnemonic('H'); helpMenu.setMnemonic('H');
@ -118,6 +149,13 @@ public class EcuLoggerMenuBar extends JMenuBar implements ActionListener {
parent.reportError(e); parent.reportError(e);
} }
} else if (evt.getSource() == reconnect) {
try {
parent.restartLogging();
} catch (Exception e) {
parent.reportError(e);
}
} }
} }

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui; package enginuity.logger.ui;
public interface MessageListener { public interface MessageListener {

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui; package enginuity.logger.ui;
import enginuity.Settings; import enginuity.Settings;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui; package enginuity.logger.ui;
import enginuity.logger.ui.handler.file.FileLoggerListener; import enginuity.logger.ui.handler.file.FileLoggerListener;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler; package enginuity.logger.ui.handler;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler; package enginuity.logger.ui.handler;
public interface DataUpdateHandlerManager extends DataUpdateHandler { public interface DataUpdateHandlerManager extends DataUpdateHandler {

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler; package enginuity.logger.ui.handler;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler; package enginuity.logger.ui.handler;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.dash; package enginuity.logger.ui.handler.dash;
import enginuity.logger.definition.ConvertorUpdateListener; import enginuity.logger.definition.ConvertorUpdateListener;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.dash; package enginuity.logger.ui.handler.dash;
import javax.swing.*; import javax.swing.*;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.dash; package enginuity.logger.ui.handler.dash;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.file; package enginuity.logger.ui.handler.file;
public interface FileLogger { public interface FileLogger {

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.file; package enginuity.logger.ui.handler.file;
import enginuity.Settings; import enginuity.Settings;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.file; package enginuity.logger.ui.handler.file;
public interface FileLoggerListener { public interface FileLoggerListener {

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.file; package enginuity.logger.ui.handler.file;
import enginuity.Settings; import enginuity.Settings;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.graph; package enginuity.logger.ui.handler.graph;
import enginuity.logger.definition.ConvertorUpdateListener; import enginuity.logger.definition.ConvertorUpdateListener;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.livedata; package enginuity.logger.ui.handler.livedata;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.livedata; package enginuity.logger.ui.handler.livedata;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.livedata; package enginuity.logger.ui.handler.livedata;
import enginuity.logger.definition.ConvertorUpdateListener; import enginuity.logger.definition.ConvertorUpdateListener;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.handler.table; package enginuity.logger.ui.handler.table;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.paramlist; package enginuity.logger.ui.paramlist;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.paramlist; package enginuity.logger.ui.paramlist;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.paramlist; package enginuity.logger.ui.paramlist;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.paramlist; package enginuity.logger.ui.paramlist;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -1,3 +1,24 @@
/*
*
* Enginuity Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006 Enginuity.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
package enginuity.logger.ui.paramlist; package enginuity.logger.ui.paramlist;
import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuData;

View File

@ -23,7 +23,7 @@ package enginuity.newmaps.definition;
import enginuity.newmaps.ecudata.Scale; import enginuity.newmaps.ecudata.Scale;
import enginuity.newmaps.ecudata.Unit; import enginuity.newmaps.ecudata.Unit;
import java.util.Iterator;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.Vector; import java.util.Vector;

View File

@ -21,23 +21,36 @@
package enginuity.newmaps.definition; package enginuity.newmaps.definition;
import static java.lang.Boolean.parseBoolean; import static enginuity.newmaps.definition.AttributeParser.parseEndian;
import static java.lang.Float.parseFloat; import static enginuity.newmaps.definition.AttributeParser.parseStorageType;
import static enginuity.util.HexUtil.hexToInt; import static enginuity.newmaps.definition.AttributeParser.parseUnitSystem;
import static java.lang.Integer.parseInt;
import static enginuity.newmaps.definition.AttributeParser.*;
import enginuity.newmaps.definition.index.Index; import enginuity.newmaps.definition.index.Index;
import enginuity.newmaps.ecudata.*;
import enginuity.util.NamedSet;
import enginuity.newmaps.definition.index.IndexItem; import enginuity.newmaps.definition.index.IndexItem;
import enginuity.newmaps.ecudata.Axis;
import enginuity.newmaps.ecudata.Category;
import enginuity.newmaps.ecudata.ECUData;
import enginuity.newmaps.ecudata.Parameter;
import enginuity.newmaps.ecudata.Rom;
import enginuity.newmaps.ecudata.Scale;
import enginuity.newmaps.ecudata.SourceDefAxis;
import enginuity.newmaps.ecudata.Switch;
import enginuity.newmaps.ecudata.SwitchGroup;
import enginuity.newmaps.ecudata.Table2D;
import enginuity.newmaps.ecudata.Table3D;
import enginuity.newmaps.ecudata.Unit;
import enginuity.newmaps.xml.SaxParserFactory; import enginuity.newmaps.xml.SaxParserFactory;
import static enginuity.util.HexUtil.hexToInt;
import enginuity.util.NamedSet;
import enginuity.util.exception.NameableNotFoundException;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
import enginuity.util.exception.NameableNotFoundException;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import static java.lang.Boolean.parseBoolean;
import static java.lang.Float.parseFloat;
import static java.lang.Integer.parseInt;
import java.util.Stack; import java.util.Stack;
public class RomDefinitionHandler extends DefaultHandler { public class RomDefinitionHandler extends DefaultHandler {

View File

@ -21,13 +21,14 @@
package enginuity.newmaps.definition.index; package enginuity.newmaps.definition.index;
import enginuity.util.NamedSet;
import java.io.Serializable;
import java.util.Iterator;
import static enginuity.util.MD5Checksum.getMD5Checksum; import static enginuity.util.MD5Checksum.getMD5Checksum;
import enginuity.util.Nameable; import enginuity.util.Nameable;
import enginuity.util.NamedSet;
import enginuity.util.exception.NameableNotFoundException; import enginuity.util.exception.NameableNotFoundException;
import java.io.File; import java.io.File;
import java.io.Serializable;
import java.util.Iterator;
public class Index extends NamedSet<IndexItem> implements Serializable { public class Index extends NamedSet<IndexItem> implements Serializable {

View File

@ -22,14 +22,14 @@
package enginuity.newmaps.definition.index; package enginuity.newmaps.definition.index;
import enginuity.newmaps.xml.SaxParserFactory; import enginuity.newmaps.xml.SaxParserFactory;
import enginuity.util.exception.NameableNotFoundException;
import org.xml.sax.SAXParseException;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import static enginuity.util.MD5Checksum.getMD5Checksum;
import enginuity.util.exception.NameableNotFoundException;
import org.xml.sax.SAXParseException;
public class IndexBuilder { public class IndexBuilder {

View File

@ -21,10 +21,11 @@
package enginuity.newmaps.definition.index; package enginuity.newmaps.definition.index;
import static enginuity.util.MD5Checksum.getMD5Checksum;
import enginuity.util.Nameable; import enginuity.util.Nameable;
import java.io.File; import java.io.File;
import java.io.Serializable; import java.io.Serializable;
import static enginuity.util.MD5Checksum.getMD5Checksum;
public class IndexItem implements Nameable, Serializable { public class IndexItem implements Nameable, Serializable {

View File

@ -23,15 +23,14 @@ package enginuity.newmaps.definition.index;
import enginuity.newmaps.definition.RomDefinitionHandler; import enginuity.newmaps.definition.RomDefinitionHandler;
import enginuity.newmaps.xml.SaxParserFactory; import enginuity.newmaps.xml.SaxParserFactory;
import static enginuity.util.MD5Checksum.getMD5Checksum;
import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.InputStream;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.util.Iterator; import java.util.Iterator;
import static enginuity.util.MD5Checksum.getMD5Checksum;
import java.io.BufferedInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
public abstract class IndexUtil { public abstract class IndexUtil {

View File

@ -32,13 +32,14 @@ import enginuity.maps.Table3D;
import enginuity.maps.TableSwitch; import enginuity.maps.TableSwitch;
import enginuity.newmaps.xml.XmlHelper; import enginuity.newmaps.xml.XmlHelper;
import enginuity.util.HexUtil; import enginuity.util.HexUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.util.Iterator; import java.util.Iterator;
import java.util.Vector; import java.util.Vector;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
public class DefinitionBuilder { public class DefinitionBuilder {

View File

@ -33,14 +33,15 @@ import enginuity.maps.Table1D;
import enginuity.maps.Table2D; import enginuity.maps.Table2D;
import enginuity.maps.Table3D; import enginuity.maps.Table3D;
import enginuity.maps.TableSwitch; import enginuity.maps.TableSwitch;
import enginuity.util.ObjectCloner;
import static enginuity.xml.DOMHelper.unmarshallAttribute; import static enginuity.xml.DOMHelper.unmarshallAttribute;
import static enginuity.xml.DOMHelper.unmarshallText; import static enginuity.xml.DOMHelper.unmarshallText;
import enginuity.util.ObjectCloner;
import enginuity.xml.RomAttributeParser; import enginuity.xml.RomAttributeParser;
import enginuity.xml.TableIsOmittedException; import enginuity.xml.TableIsOmittedException;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import static org.w3c.dom.Node.ELEMENT_NODE; import static org.w3c.dom.Node.ELEMENT_NODE;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import javax.management.modelmbean.XMLParseException; import javax.management.modelmbean.XMLParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;

View File

@ -23,11 +23,12 @@ package enginuity.newmaps.definition.translate;
import com.sun.org.apache.xerces.internal.parsers.DOMParser; import com.sun.org.apache.xerces.internal.parsers.DOMParser;
import enginuity.maps.Rom; import enginuity.maps.Rom;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.util.Vector; import java.util.Vector;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
public class FirstGenTranslator { public class FirstGenTranslator {

View File

@ -23,6 +23,7 @@ package enginuity.newmaps.ecudata;
import enginuity.util.Nameable; import enginuity.util.Nameable;
import enginuity.util.NamedSet; import enginuity.util.NamedSet;
import java.io.Serializable; import java.io.Serializable;
import java.util.Iterator; import java.util.Iterator;

View File

@ -22,6 +22,7 @@
package enginuity.newmaps.ecudata; package enginuity.newmaps.ecudata;
import enginuity.util.Nameable; import enginuity.util.Nameable;
import java.io.Serializable; import java.io.Serializable;
public abstract class ECUData implements Nameable, Serializable { public abstract class ECUData implements Nameable, Serializable {

View File

@ -23,6 +23,7 @@ package enginuity.newmaps.ecudata;
import enginuity.util.Nameable; import enginuity.util.Nameable;
import enginuity.util.NamedSet; import enginuity.util.NamedSet;
import java.io.Serializable; import java.io.Serializable;
public class Rom implements Nameable, Serializable { public class Rom implements Nameable, Serializable {

View File

@ -22,6 +22,7 @@
package enginuity.newmaps.ecudata; package enginuity.newmaps.ecudata;
import enginuity.util.Nameable; import enginuity.util.Nameable;
import java.io.Serializable; import java.io.Serializable;
public class Scale implements Nameable, Serializable { public class Scale implements Nameable, Serializable {

View File

@ -22,6 +22,7 @@
package enginuity.newmaps.ecudata; package enginuity.newmaps.ecudata;
import static enginuity.newmaps.definition.AttributeParser.stringToStringArray; import static enginuity.newmaps.definition.AttributeParser.stringToStringArray;
import java.io.Serializable; import java.io.Serializable;
public class SourceDefAxis extends Axis implements Serializable { public class SourceDefAxis extends Axis implements Serializable {

View File

@ -21,9 +21,10 @@
package enginuity.newmaps.ecudata; package enginuity.newmaps.ecudata;
import java.io.Serializable;
import static enginuity.newmaps.definition.AttributeParser.stringToByteArray; import static enginuity.newmaps.definition.AttributeParser.stringToByteArray;
import java.io.Serializable;
public class Switch extends ECUData implements Serializable { public class Switch extends ECUData implements Serializable {
protected byte[] stateOn = new byte[1]; protected byte[] stateOn = new byte[1];

View File

@ -23,6 +23,7 @@ package enginuity.newmaps.ecudata;
import enginuity.util.NamedSet; import enginuity.util.NamedSet;
import enginuity.util.exception.NameableNotFoundException; import enginuity.util.exception.NameableNotFoundException;
import java.util.Iterator; import java.util.Iterator;
public class SwitchGroup extends ECUData { public class SwitchGroup extends ECUData {

View File

@ -22,6 +22,7 @@
package enginuity.newmaps.ecudata; package enginuity.newmaps.ecudata;
import enginuity.util.Nameable; import enginuity.util.Nameable;
import java.io.Serializable; import java.io.Serializable;
public class Unit implements Nameable, Serializable { public class Unit implements Nameable, Serializable {

View File

@ -21,8 +21,7 @@
package enginuity.newmaps.swing; package enginuity.newmaps.swing;
import javax.swing.JTable; import javax.swing.*;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
public class Table extends JTable implements ListSelectionModel { public class Table extends JTable implements ListSelectionModel {

View File

@ -21,11 +21,8 @@
package enginuity.newmaps.swing; package enginuity.newmaps.swing;
import java.awt.BorderLayout; import javax.swing.*;
import java.awt.Color; import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
class TableFrame extends JFrame { class TableFrame extends JFrame {
// Instance attributes used in this example // Instance attributes used in this example

View File

@ -22,13 +22,13 @@
package enginuity.newmaps.xml; package enginuity.newmaps.xml;
import enginuity.logger.exception.ConfigurationException; import enginuity.logger.exception.ConfigurationException;
import java.io.ByteArrayOutputStream; import org.w3c.dom.Document;
import java.io.IOException; import org.w3c.dom.Element;
import java.io.InputStream; import org.w3c.dom.Node;
import java.io.OutputStream; import org.w3c.dom.NodeList;
import java.util.ArrayList; import org.w3c.dom.Text;
import java.util.Collections; import org.xml.sax.SAXException;
import java.util.List;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
@ -39,12 +39,13 @@ import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document; import java.io.ByteArrayOutputStream;
import org.w3c.dom.Element; import java.io.IOException;
import org.w3c.dom.Node; import java.io.InputStream;
import org.w3c.dom.NodeList; import java.io.OutputStream;
import org.w3c.dom.Text; import java.util.ArrayList;
import org.xml.sax.SAXException; import java.util.Collections;
import java.util.List;
final public class XmlHelper extends Object { final public class XmlHelper extends Object {

View File

@ -25,14 +25,13 @@ import ZoeloeSoft.projects.JFontChooser.JFontChooser;
import enginuity.ECUEditor; import enginuity.ECUEditor;
import enginuity.Settings; import enginuity.Settings;
import enginuity.util.FileAssociator; import enginuity.util.FileAssociator;
import java.awt.Color;
import java.awt.Dimension; import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.io.File; import java.io.File;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import javax.swing.JColorChooser;
import javax.swing.JFrame;
public class SettingsForm extends JFrame implements MouseListener { public class SettingsForm extends JFrame implements MouseListener {

View File

@ -21,7 +21,8 @@
package enginuity.util; package enginuity.util;
import java.io.*; import java.io.FileInputStream;
import java.io.InputStream;
import java.security.MessageDigest; import java.security.MessageDigest;
public class MD5Checksum { public class MD5Checksum {

View File

@ -22,6 +22,7 @@
package enginuity.util; package enginuity.util;
import enginuity.util.exception.NameableNotFoundException; import enginuity.util.exception.NameableNotFoundException;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;

View File

@ -23,8 +23,6 @@ package enginuity.util;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;

View File

@ -32,7 +32,7 @@ public final class ThreadUtil {
try { try {
TimeUnit.MILLISECONDS.sleep(millis); TimeUnit.MILLISECONDS.sleep(millis);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); //e.printStackTrace();
} }
} }