remove romraider (#3972)

* remove romraider

* various stuff that referenced RR

* s
This commit is contained in:
Matthew Kennedy 2022-03-05 05:38:24 -08:00 committed by GitHub
parent 8eff02a5d3
commit c38a5e5f5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
200 changed files with 4 additions and 21783 deletions

View File

@ -75,7 +75,6 @@
<src path="logging-api/src/main/java"/>
<src path="ui/src/main/java"/>
<src path="ui/src/test/java"/>
<src path="romraider/src/main/java"/>
<src path="logging/src/main/java"/>
<!-- not really used at the moment but let's compile for the sake of Eclipse users -->
<src path="tools/src/main/java"/>
@ -112,7 +111,6 @@
<fileset dir="inifile/src/test/java" includes="**/*Test.java"/>
<fileset dir="models/src/test/java" includes="**/*Test.java"/>
<fileset dir="ui/src/test/java" includes="**/*Test.java"/>
<fileset dir="romraider/src/main/java" includes="**/test/**/*Test.java"/>
<fileset dir="logging/src/main/java" includes="**/test/**/*Test.java"/>
</batchtest>
</junit>
@ -154,7 +152,6 @@
<fileset dir="ui/resources" includes="**/*.gif"/>
<fileset dir="ui/resources" includes="**/*.png"/>
<fileset dir="ui/resources" includes="**/*.jpg"/>
<fileset dir="romraider/resources" includes="**/*.*"/>
</copy>
<tstamp>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="log4j" level="project" />
<orderEntry type="library" name="jep" level="project" />
<orderEntry type="library" name="swing-layout" level="project" />
<orderEntry type="module" module-name="ui" />
<orderEntry type="module" module-name="io" exported="" />
<orderEntry type="module" module-name="models" exported="" />
<orderEntry type="module" module-name="inifile" exported="" />
<orderEntry type="module" module-name="logging" exported="" />
</component>
</module>

View File

@ -1,271 +0,0 @@
/********************************************************************************
* ********************************************************* *
* * $Package: ZoeloeSoft.projects.JFontChooser * *
* * $Id: JFontChooser.java * *
* * $Date: 23:39 19/04/2004 * *
* * * *
* * $Creator: Tim Eeckhaut * *
* * $Alias: zoeloeboeloe * *
* * * *
* * $Company: ZoeloeSoft * *
* * $Website: http://users.pandora.be/ZoeloeSof * *
* ********************************************************* *
* *
* Copyright (c) 2004, Tim Eeckhaut *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the company nor the names of its *
* contributors may be used to endorse or promote products derived from this *
* software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR *
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
********************************************************************************/
package ZoeloeSoft.projects.JFontChooser;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GraphicsEnvironment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
public class JFontChooser extends JDialog
{
public static int OK_OPTION = 0;
public static int CANCEL_OPTION = 1;
private JList fontList, sizeList;
private JCheckBox cbBold, cbItalic;
private JTextArea txtSample;
private int OPTION;
private final String[] sizes = new String[]
{ "2","4","6","8","10","11","12","13","14","16","18","20","22","24","30","36","48","72" };
public int showDialog(Font font)
{
setFont(font);
return showDialog();
}
public int showDialog()
{
setVisible(true);
return OPTION;
}
public JFontChooser(Frame parent)
{
super(parent, true);
setTitle("JFontChooser");
OPTION = JFontChooser.CANCEL_OPTION;
// create all components
JButton btnOK = new JButton("OK");
btnOK.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
JFontChooser.this.OPTION = JFontChooser.OK_OPTION;
JFontChooser.this.setVisible(false);
}
});
JButton btnCancel = new JButton("Cancel");
btnCancel.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
JFontChooser.this.OPTION = JFontChooser.CANCEL_OPTION;
JFontChooser.this.setVisible(false);
}
});
fontList = new JList(GraphicsEnvironment.getLocalGraphicsEnvironment().
getAvailableFontFamilyNames())
{
@Override
public Dimension getPreferredScrollableViewportSize()
{ return new Dimension(150, 144); }
};
fontList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
sizeList = new JList(sizes)
{
@Override
public Dimension getPreferredScrollableViewportSize()
{ return new Dimension(25, 144); }
};
sizeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
cbBold = new JCheckBox("Bold");
cbItalic = new JCheckBox("Italic");
txtSample = new JTextArea()
{
@Override
public Dimension getPreferredScrollableViewportSize()
{ return new Dimension(385, 80); }
};
txtSample.setFont(new Font("Monospaced", Font.PLAIN, 12));
txtSample.setText("The quick brown fox jumped over the fence");
// set the default font
setFont(null);
// add the listeners
ListSelectionListener listListener = new ListSelectionListener()
{
@Override
public void valueChanged(ListSelectionEvent e)
{ txtSample.setFont(getCurrentFont()); }
};
fontList.addListSelectionListener(listListener);
sizeList.addListSelectionListener(listListener);
ActionListener cbListener = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{ txtSample.setFont(getCurrentFont()); }
};
cbBold.addActionListener(cbListener);
cbItalic.addActionListener(cbListener);
// build the container
getContentPane().setLayout(new java.awt.BorderLayout());
JPanel leftPanel = new JPanel();
leftPanel.setLayout(new java.awt.BorderLayout());
leftPanel.add(new JScrollPane(fontList), java.awt.BorderLayout.CENTER);
leftPanel.add(new JScrollPane(sizeList), java.awt.BorderLayout.EAST);
getContentPane().add(leftPanel, java.awt.BorderLayout.CENTER);
JPanel rightPanel = new JPanel();
rightPanel.setLayout(new java.awt.BorderLayout());
JPanel rightPanelSub1 = new JPanel();
rightPanelSub1.setLayout(new java.awt.FlowLayout());
rightPanelSub1.add(cbBold);
rightPanelSub1.add(cbItalic);
rightPanel.add(rightPanelSub1, java.awt.BorderLayout.NORTH);
JPanel rightPanelSub2 = new JPanel();
rightPanelSub2.setLayout(new java.awt.GridLayout(2, 1));
rightPanelSub2.add(btnOK);
rightPanelSub2.add(btnCancel);
rightPanel.add(rightPanelSub2, java.awt.BorderLayout.SOUTH);
getContentPane().add(rightPanel, java.awt.BorderLayout.EAST);
getContentPane().add(new JScrollPane(txtSample), java.awt.BorderLayout.SOUTH);
setSize(200, 200);
setResizable(false);
pack();
}
@Override
public void setFont(Font font)
{
if (font == null) font = txtSample.getFont();
fontList.setSelectedValue(font.getName(), true);
fontList.ensureIndexIsVisible(fontList.getSelectedIndex());
sizeList.setSelectedValue("" + font.getSize(), true);
sizeList.ensureIndexIsVisible(sizeList.getSelectedIndex());
cbBold.setSelected(font.isBold());
cbItalic.setSelected(font.isItalic());
}
@Override
public Font getFont()
{
if (OPTION == OK_OPTION)
{
return getCurrentFont();
}
else return null;
}
private Font getCurrentFont()
{
try {
String fontFamily = (String)fontList.getSelectedValue();
int fontSize = Integer.parseInt((String)sizeList.getSelectedValue());
int fontType = Font.PLAIN;
if (cbBold.isSelected()) fontType += Font.BOLD;
if (cbItalic.isSelected()) fontType += Font.ITALIC;
return new Font(fontFamily, fontType, fontSize);
} catch (Exception ex) {
// if error return current sample font.
return txtSample.getFont();
}
}
}

View File

@ -1,127 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider;
import com.romraider.editor.ecu.ECUEditor;
import com.romraider.util.JREChecker;
import org.apache.log4j.Logger;
import java.io.File;
import java.text.DateFormat;
import static com.romraider.Version.*;
import static com.romraider.editor.ecu.ECUEditorManager.getECUEditor;
import static com.romraider.swing.LookAndFeelManager.initLookAndFeel;
import static com.romraider.util.LogManager.initDebugLogging;
import static javax.swing.JOptionPane.*;
import static javax.swing.SwingUtilities.invokeLater;
import static org.apache.log4j.Logger.getLogger;
public class ECUExec {
private static final Logger LOGGER = getLogger(ECUExec.class);
private static final String START_LOGGER_ARG = "-logger";
private static final String START_LOGGER_FULLSCREEN_ARG = "-logger.fullscreen";
private ECUExec() {
throw new UnsupportedOperationException();
}
public static void main(String args[]) {
// init debug logging
initDebugLogging();
// dump the system properties to the log file as early as practical to
// help debugging/support
LOGGER.info(PRODUCT_NAME + " " + VERSION + " Build: " + BUILDNUMBER);
LOGGER.info("When requesting assistance at " + SUPPORT_URL + " please include the System Properties information below:");
LOGGER.info(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.LONG).format(System.currentTimeMillis()));
LOGGER.info("System Properties: \n\t"
+ System.getProperties().toString().replace(",", "\n\t"));
// 64-bit won't work with the native libs (e.g. serial rxtx) but won't
// fail until we actually try to use them we'll just warn here
if (!JREChecker.is32bit() &&
!containsLoggerArg(args)) {
showMessageDialog(null,
"Incompatible JRE detected.\n" +
PRODUCT_NAME +
" requires a 32-bit JRE for some operations.\nSome features may be unavailable.",
"JRE Incompatibility Warning",
WARNING_MESSAGE);
}
// check for dodgy threading - dev only
//RepaintManager.setCurrentManager(new ThreadCheckingRepaintManager(true));
// set look and feel
initLookAndFeel();
// check if already running
openEditor(args);
}
private static void showAlreadyRunningMessage() {
showMessageDialog(null, PRODUCT_NAME + " is already running.", PRODUCT_NAME, INFORMATION_MESSAGE);
}
private static boolean containsLoggerArg(String[] args) {
for (String arg : args) {
if (arg.equalsIgnoreCase(START_LOGGER_ARG) || arg.equalsIgnoreCase(START_LOGGER_FULLSCREEN_ARG)) {
return true;
}
}
return false;
}
public static void openRom(final ECUEditor editor, final String rom) {
invokeLater(new Runnable() {
@Override
public void run() {
try {
File file = new File(rom);
editor.openImage(file);
} catch (Exception ex) {
LOGGER.error("Error opening rom", ex);
}
}
});
}
private static void openEditor(String[] args) {
ECUEditor editor = getECUEditor();
editor.initializeEditorUI();
editor.checkDefinitions();
if (args.length > 0) {
openRom(editor, args[0]);
}
//startRomListener(editor);
}
// private static void startRomListener(ECUEditor editor) {
// try {
// while (true) {
// String rom = waitForRom();
// openRom(editor, rom);
// }
// } catch (Throwable e) {
// LOGGER.error("Error occurred", e);
// }
// }
}

View File

@ -1,873 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2014 RomRaider.com
*
* 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 com.romraider;
import static com.romraider.Version.RELEASE_NOTES;
//import static com.romraider.Version.ROM_REVISION_URL;
import static com.romraider.Version.SUPPORT_URL;
import static com.romraider.util.ParamChecker.checkNotNullOrEmpty;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import java.io.File;
import java.io.Serializable;
import java.util.Locale;
import java.util.Map;
import java.util.Vector;
import com.romraider.io.connection.ConnectionProperties;
import com.romraider.logger.ecu.definition.EcuDefinition;
//import com.romraider.logger.external.phidget.interfacekit.io.IntfKitSensor;
public class Settings implements Serializable {
private static final long serialVersionUID = 1026542922680475190L;
/* String Format Settings */
public static final String NEW_LINE = System.getProperty("line.separator");
public static final String TAB = "\t";
public static final String BLANK = "";
/* Clipboard Settings */
public static final String TABLE_CLIPBOARD_FORMAT_ELEMENT = "table-clipboard-format";
public static final String TABLE_CLIPBOARD_FORMAT_ATTRIBUTE = "format-string";
public static final String TABLE_ELEMENT = "table";
public static final String TABLE1D_ELEMENT = "table1D";
public static final String TABLE2D_ELEMENT = "table2D";
public static final String TABLE3D_ELEMENT = "table3D";
public static final String TABLE_HEADER_ATTRIBUTE = "table-header";
public static final String DEFAULT_CLIPBOARD_FORMAT = "Default";
public static final String DEFAULT_TABLE_HEADER = "[Table1D]" + NEW_LINE;
public static final String DEFAULT_TABLE1D_HEADER = "";
public static final String DEFAULT_TABLE2D_HEADER = "[Table2D]" + NEW_LINE;
public static final String DEFAULT_TABLE3D_HEADER = "[Table3D]" + NEW_LINE;
public static final String AIRBOYS_CLIPBOARD_FORMAT = "Airboys";
public static final String AIRBOYS_TABLE_HEADER = "";
public static final String AIRBOYS_TABLE1D_HEADER = "";
public static final String AIRBOYS_TABLE2D_HEADER = "[Table2D]" + NEW_LINE;
public static final String AIRBOYS_TABLE3D_HEADER = "[Table3D]" + TAB;
public static final String CUSTOM_CLIPBOARD_FORMAT = "Custom";
/* XML Settings */
public static final String REPOSITORY_ELEMENT_NAME = "repository-dir";
public static final String REPOSITORY_ATTRIBUTE_NAME = "path";
public static final String ICONS_ELEMENT_NAME = "icons";
public static final String EDITOR_ICONS_ELEMENT_NAME = "editor-toolbar";
public static final String EDITOR_ICONS_SCALE_ATTRIBUTE_NAME = "scale";
public static final String TABLE_ICONS_ELEMENT_NAME = "table-toolbar";
public static final String TABLE_ICONS_SCALE_ATTRIBUTE_NAME = "scale";
/* UI Settings */
public static final int DEFAULT_EDITOR_ICON_SCALE = 50;
public static final int DEFAULT_TABLE_ICON_SCALE = 70;
/* Table Settings */
public static final String defaultTableToolBarName = "Table Tools";
public static final int ENDIAN_LITTLE = 1;
public static final int ENDIAN_BIG = 2;
public static final int TABLE_1D = 1;
public static final int TABLE_2D = 2;
public static final int TABLE_3D = 3;
public static final int TABLE_X_AXIS = 4;
public static final int TABLE_Y_AXIS = 5;
public static final int TABLE_SWITCH = 6;
public static final int DATA_TYPE_ORIGINAL = 0;
public static final int DATA_TYPE_BIN = 1;
public static final int DATA_TYPE_REAL = 3;
public static final int COMPARE_DISPLAY_PERCENT = 1;
public static final int COMPARE_DISPLAY_ABSOLUTE = 2;
public static final int STORAGE_TYPE_FLOAT = 99;
public static final boolean STORAGE_DATA_SIGNED = false;
public static final Color UNCHANGED_VALUE_COLOR = new Color(160, 160, 160);
public static final String INVALID_ATTRIBUTE_TEXT = "invalid";
public static final String DEFAULT_TABLE_NAME = "Unknown";
/* Rom Settings */
public static final int CHECK_TOTAL = 0x5AA5A55A;
public static final int SIXTEENBIT_START_ADDRESS = 0x20000;
public static final int SIXTEENBIT_END_ADDRESS = 0x28000;
public static final int SIXTEENBIT_SMALL_SIZE = 0x28000;
public static final int SIXTEENBIT_LARGE_SIZE = 0x30000;
public static final int SIXTEENBIT_SEGMENT_SIZE = SIXTEENBIT_SMALL_SIZE - SIXTEENBIT_START_ADDRESS; // 0x8000
public static final int SIXTEENBIT_SEGMENT_VALUE = 0x00;
/* Scale Settings */
public static final int LINEAR = 1;
public static final int INVERSE = 2;
/* Compare Image Settings */
public static Color TABLE_EQUAL_COLOR = new Color(52,114,53);
public static Color TABLE_DIFFERENT_COLOR = new Color(193, 27, 23);
public static Color TABLE_MISSING_COLOR = new Color(251,185,23);
/* Compare DTC Foreground Colors */
public static Color TABLESWITCH_DEFAULT_COLOR = Color.black;
public static Color TABLESWITCH_DIFFERENT_COLOR = new Color(193, 27, 23);
/* MDI Desktop Settings*/
public static int FRAME_OFFSET = 20;
/* Scale Settings */
public static String DEFAULT_SCALE = "Default";
public static String METRIC_SCALE = "Metric";
public static String STANDARD_SCALE = "Standard";
/* DataCell Colors */
public static final Color scaleTextColor = new Color(0, 0, 0);
public static final Color highlightTextColor = new Color(255, 255, 255);
public static final Color selectTextColor = new Color(0, 0, 0);
public static final Color liveDataTraceTextColor = new Color(50, 50, 50);
private static final String ISO15765 = "ISO15765";
private static final String ISO9141 = "ISO9141";
private static final String SYSTEM_NUMFORMAT = "system";
private static final String USER_LANGUAGE = "user.language";
private static final String USER_COUNTRY = "user.country";
private static final String EN_US = "en_US";
private static final String SSM = "SSM";
private static final String OBD = "OBD";
private final Dimension windowSize = new Dimension(800, 600);
private final Point windowLocation = new Point();
private int splitPaneLocation = 150;
private boolean windowMaximized;
private String recentVersion = "x";
private Vector<File> ecuDefinitionFiles = new Vector<File>();
private File lastImageDir = new File("images");
private File lastRepositoryDir = new File("repositories");
private boolean obsoleteWarning = true;
private boolean calcConflictWarning = true;
private boolean debug;
private int userLevel = 1;
private boolean saveDebugTables = true;
private boolean displayHighTables = true;
private boolean valueLimitWarning = true;
private Font tableFont = new Font("Arial", Font.BOLD, 11);
private Dimension cellSize = new Dimension(42, 18);
private Color maxColor = new Color(255, 102, 102);
private Color minColor = new Color(153, 153, 255);
private Color selectColor = new Color(204, 204, 204);
private Color highlightColor = new Color(27, 161, 226);
private Color liveValueColor = new Color (0, 255, 0);
private Color decreaseBorder = new Color(0, 0, 255);
private Color increaseBorder = new Color(255, 0, 0);
private Color axisColor = new Color(255, 255, 255);
private Color warningColor = new Color(255, 0, 0);
private int tableClickCount = 1; // number of clicks to open table
private int tableClickBehavior = 0; // TableTreeNode click behavior. 0=open/close frame, 1=open/focus frame
private boolean colorAxis = false;
private String loggerPort;
private String loggerPortDefault;
private static String loggerProtocol = SSM;
private static String loggerDefinitionFilePath;
private static String loggerProfileFilePath;
private static String loggerOutputDirPath = System.getProperty("user.home");
private String fileLoggingControllerSwitchId = "S20"; // defogger switch by default
private boolean fileLoggingControllerSwitchActive = true;
private boolean fileLoggingAbsoluteTimestamp;
private String logfileNameText;
private boolean logExternalsOnly;
private static String userLocale = SYSTEM_NUMFORMAT;
private Dimension loggerWindowSize = new Dimension(1000, 600);
private Point loggerWindowLocation = new Point();
private boolean loggerWindowMaximized;
private int loggerSelectedTabIndex;
private boolean loggerParameterListState = true;
private ConnectionProperties loggerConnectionProperties;
private Map<String, EcuDefinition> loggerEcuDefinitionMap;
private Map<String, String> loggerPluginPorts;
private boolean loggerRefreshMode;
private static byte loggerDestinationId = 0x10;
private boolean fastPoll = true;
private double loggerDividerLocation = 400;
private String loggerDebuggingLevel = "info";
private static String j2534Device;
private static String transportProtocol = ISO9141;
private String tableClipboardFormat = DEFAULT_CLIPBOARD_FORMAT; // Currently 2 options. Default and Airboy. Custom is not hooked up.
private String tableHeader = DEFAULT_TABLE_HEADER;
private String table1DHeader = DEFAULT_TABLE1D_HEADER;
private String table2DHeader = DEFAULT_TABLE2D_HEADER;
private String table3DHeader = DEFAULT_TABLE3D_HEADER;
private int editorIconScale = DEFAULT_EDITOR_ICON_SCALE;
private int tableIconScale = DEFAULT_TABLE_ICON_SCALE;
private boolean openExpanded = true;
private boolean showTableToolbarBorder = false;
private boolean alwaysOpenTableAtZero = false;
private boolean scaleHeadersAndData = true;
private String defaultScale = "Metric";
// private Map<String, IntfKitSensor> phidgetSensors;
public Settings() {
//center window by default
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
windowLocation.move(((int) (screenSize.getWidth() - windowSize.getWidth()) / 2),
((int) (screenSize.getHeight() - windowSize.getHeight()) / 2));
}
public Dimension getWindowSize() {
return windowSize;
}
public Point getWindowLocation() {
return windowLocation;
}
public void setWindowSize(Dimension size) {
windowSize.setSize(size);
}
public void setWindowLocation(Point location) {
windowLocation.setLocation(location);
}
public Vector<File> getEcuDefinitionFiles() {
return ecuDefinitionFiles;
}
public void addEcuDefinitionFile(File ecuDefinitionFile) {
ecuDefinitionFiles.add(ecuDefinitionFile);
}
public void setEcuDefinitionFiles(Vector<File> ecuDefinitionFiles) {
this.ecuDefinitionFiles = ecuDefinitionFiles;
}
public File getLastImageDir() {
return lastImageDir;
}
public void setLastImageDir(File lastImageDir) {
this.lastImageDir = lastImageDir;
}
public File getLastRepositoryDir() {
return lastRepositoryDir;
}
public void setLastRepositoryDir(File lastRepositoryDir) {
this.lastRepositoryDir = lastRepositoryDir;
}
public int getSplitPaneLocation() {
return splitPaneLocation;
}
public void setSplitPaneLocation(int splitPaneLocation) {
this.splitPaneLocation = splitPaneLocation;
}
public boolean isWindowMaximized() {
return windowMaximized;
}
public void setWindowMaximized(boolean windowMaximized) {
this.windowMaximized = windowMaximized;
}
// public String getRomRevisionURL() {
// return ROM_REVISION_URL;
// }
public String getSupportURL() {
return SUPPORT_URL;
}
public Font getTableFont() {
return tableFont;
}
public void setTableFont(Font tableFont) {
this.tableFont = tableFont;
}
public boolean isObsoleteWarning() {
return obsoleteWarning;
}
public void setObsoleteWarning(boolean obsoleteWarning) {
this.obsoleteWarning = obsoleteWarning;
}
public boolean isDebug() {
return debug;
}
public void setDebug(boolean debug) {
this.debug = debug;
}
public Dimension getCellSize() {
return cellSize;
}
public void setCellSize(Dimension cellSize) {
this.cellSize = cellSize;
}
public Color getMaxColor() {
return maxColor;
}
public void setMaxColor(Color maxColor) {
this.maxColor = maxColor;
}
public Color getMinColor() {
return minColor;
}
public void setMinColor(Color minColor) {
this.minColor = minColor;
}
public Color getHighlightColor() {
return highlightColor;
}
public void setHighlightColor(Color highlightColor) {
this.highlightColor = highlightColor;
}
public Color getliveValueColor() {
return this.liveValueColor;
}
public void setLiveValueColor(Color liveValueColor) {
this.liveValueColor = liveValueColor;
}
public Color getSelectColor() {
return selectColor;
}
public void setSelectColor(Color selectColor) {
this.selectColor = selectColor;
}
public boolean isCalcConflictWarning() {
return calcConflictWarning;
}
public void setCalcConflictWarning(boolean calcConflictWarning) {
this.calcConflictWarning = calcConflictWarning;
}
public Color getIncreaseBorder() {
return increaseBorder;
}
public void setIncreaseBorder(Color increaseBorder) {
this.increaseBorder = increaseBorder;
}
public Color getDecreaseBorder() {
return decreaseBorder;
}
public void setDecreaseBorder(Color decreaseBorder) {
this.decreaseBorder = decreaseBorder;
}
public Color getAxisColor() {
return axisColor;
}
public void setAxisColor(Color axisColor) {
this.axisColor = axisColor;
}
public int getUserLevel() {
return userLevel;
}
public void setUserLevel(int userLevel) {
if (userLevel > 5) {
this.userLevel = 5;
} else if (userLevel < 1) {
this.userLevel = 1;
} else {
this.userLevel = userLevel;
}
}
public int getTableClickCount() {
return tableClickCount;
}
public void setTableClickCount(int tableClickCount) {
this.tableClickCount = tableClickCount;
}
public int getTableClickBehavior() {
return tableClickBehavior;
}
public void setTableClickBehavior(int clickBehavior) {
// 0 = open/close
// 1 = open/focus
this.tableClickBehavior = clickBehavior;
}
public String getRecentVersion() {
return recentVersion;
}
public void setRecentVersion(String recentVersion) {
this.recentVersion = recentVersion;
}
public String getReleaseNotes() {
return RELEASE_NOTES;
}
public boolean isSaveDebugTables() {
return saveDebugTables;
}
public void setSaveDebugTables(boolean saveDebugTables) {
this.saveDebugTables = saveDebugTables;
}
public boolean isDisplayHighTables() {
return displayHighTables;
}
public void setDisplayHighTables(boolean displayHighTables) {
this.displayHighTables = displayHighTables;
}
public boolean isValueLimitWarning() {
return valueLimitWarning;
}
public void setValueLimitWarning(boolean valueLimitWarning) {
this.valueLimitWarning = valueLimitWarning;
}
public Color getWarningColor() {
return warningColor;
}
public void setWarningColor(Color warningColor) {
this.warningColor = warningColor;
}
public String getLoggerPort() {
return loggerPort;
}
public void setLoggerPort(String loggerPort) {
this.loggerPort = loggerPort;
}
public String getLoggerPortDefault() {
return loggerPortDefault;
}
public void setLoggerPortDefault(String loggerPortDefault) {
this.loggerPortDefault = loggerPortDefault;
}
public void setLoggerProtocol(String protocol) {
Settings.loggerProtocol = protocol;
}
public String getLoggerProtocol() {
return loggerProtocol;
}
public String getLoggerDefinitionFilePath() {
return loggerDefinitionFilePath;
}
public void setLoggerDefinitionFilePath(String loggerDefinitionFilePath) {
Settings.loggerDefinitionFilePath = loggerDefinitionFilePath;
}
public String getLoggerOutputDirPath() {
return loggerOutputDirPath;
}
public Point getLoggerWindowLocation() {
return loggerWindowLocation;
}
public void setLoggerWindowLocation(Point loggerWindowLocation) {
this.loggerWindowLocation = loggerWindowLocation;
}
public boolean isLoggerWindowMaximized() {
return loggerWindowMaximized;
}
public void setLoggerWindowMaximized(boolean loggerWindowMaximized) {
this.loggerWindowMaximized = loggerWindowMaximized;
}
public Dimension getLoggerWindowSize() {
return loggerWindowSize;
}
public void setLoggerWindowSize(Dimension loggerWindowSize) {
this.loggerWindowSize = loggerWindowSize;
}
public double getDividerLocation() {
return loggerDividerLocation;
}
public void setLoggerDividerLocation(double dividerLocation) {
this.loggerDividerLocation = dividerLocation;
}
public String getLoggerProfileFilePath() {
return loggerProfileFilePath;
}
public void setLoggerProfileFilePath(String loggerProfileFilePath) {
Settings.loggerProfileFilePath = loggerProfileFilePath;
}
public void setLoggerOutputDirPath(String loggerOutputDirPath) {
Settings.loggerOutputDirPath = loggerOutputDirPath;
}
public String getFileLoggingControllerSwitchId() {
return fileLoggingControllerSwitchId;
}
public void setFileLoggingControllerSwitchId(String fileLoggingControllerSwitchId) {
checkNotNullOrEmpty(fileLoggingControllerSwitchId, "fileLoggingControllerSwitchId");
this.fileLoggingControllerSwitchId = fileLoggingControllerSwitchId;
}
public boolean isFileLoggingControllerSwitchActive() {
return fileLoggingControllerSwitchActive;
}
public void setFileLoggingControllerSwitchActive(boolean fileLoggingControllerSwitchActive) {
this.fileLoggingControllerSwitchActive = fileLoggingControllerSwitchActive;
}
public boolean isFileLoggingAbsoluteTimestamp() {
return fileLoggingAbsoluteTimestamp;
}
public void setFileLoggingAbsoluteTimestamp(boolean fileLoggingAbsoluteTimestamp) {
this.fileLoggingAbsoluteTimestamp = fileLoggingAbsoluteTimestamp;
}
public ConnectionProperties getLoggerConnectionProperties() {
return loggerConnectionProperties;
}
public void setLoggerConnectionProperties(ConnectionProperties loggerConnectionProperties) {
this.loggerConnectionProperties = loggerConnectionProperties;
}
public Map<String, EcuDefinition> getLoggerEcuDefinitionMap() {
return loggerEcuDefinitionMap;
}
public void setLoggerEcuDefinitionMap(Map<String, EcuDefinition> loggerEcuDefinitionMap) {
this.loggerEcuDefinitionMap = loggerEcuDefinitionMap;
}
public void setLoggerSelectedTabIndex(int loggerSelectedTabIndex) {
this.loggerSelectedTabIndex = loggerSelectedTabIndex;
}
public int getLoggerSelectedTabIndex() {
return loggerSelectedTabIndex;
}
public Map<String, String> getLoggerPluginPorts() {
return loggerPluginPorts;
}
public void setLoggerPluginPorts(Map<String, String> loggerPluginPorts) {
this.loggerPluginPorts = loggerPluginPorts;
}
public void setLoggerParameterListState(boolean ShowListState) {
this.loggerParameterListState = ShowListState;
}
public boolean getLoggerParameterListState() {
return loggerParameterListState;
}
public void setRefreshMode(boolean selected) {
this.loggerRefreshMode = selected;
}
public boolean getRefreshMode() {
return loggerRefreshMode;
}
public void setDestinationId(byte id) {
loggerDestinationId = id;
}
public byte getDestinationId() {
return loggerDestinationId;
}
public void setFastPoll(boolean state) {
this.fastPoll = state;
}
public boolean isFastPoll() {
return fastPoll;
}
public void setLogfileNameText(String text) {
this.logfileNameText = text;
}
public String getLogfileNameText() {
return logfileNameText;
}
public void setLoggerDebuggingLevel(String level) {
this.loggerDebuggingLevel = level;
}
public String getLoggerDebuggingLevel() {
return loggerDebuggingLevel;
}
public void setJ2534Device(String j2534Device) {
Settings.j2534Device = j2534Device;
}
public String getJ2534Device() {
return j2534Device;
}
public void setTransportProtocol(String transport) {
Settings.transportProtocol = transport;
}
public String getTransportProtocol() {
return transportProtocol;
}
public void setTableClipboardFormat(String formatString) {
this.tableClipboardFormat = formatString;
}
public String getTableClipboardFormat() {
return this.tableClipboardFormat;
}
public void setTableHeader(String header) {
this.tableHeader = header;
}
public String getTableHeader() {
return this.tableHeader;
}
public void setTable1DHeader(String header) {
this.table1DHeader = header;
}
public String getTable1DHeader() {
return this.table1DHeader;
}
public void setTable2DHeader(String header) {
this.table2DHeader = header;
}
public String getTable2DHeader() {
return this.table2DHeader;
}
public void setTable3DHeader(String header) {
this.table3DHeader = header;
}
public String getTable3DHeader() {
return this.table3DHeader;
}
public void setDefaultFormat() {
this.tableClipboardFormat = DEFAULT_CLIPBOARD_FORMAT;
this.tableHeader = DEFAULT_TABLE_HEADER;
this.table1DHeader = DEFAULT_TABLE1D_HEADER;
this.table2DHeader = DEFAULT_TABLE2D_HEADER;
this.table3DHeader = DEFAULT_TABLE3D_HEADER;
}
public void setAirboysFormat() {
this.tableClipboardFormat = AIRBOYS_CLIPBOARD_FORMAT;
this.tableHeader = AIRBOYS_TABLE_HEADER;
this.table1DHeader = AIRBOYS_TABLE1D_HEADER;
this.table2DHeader = AIRBOYS_TABLE2D_HEADER;
this.table3DHeader = AIRBOYS_TABLE3D_HEADER;
}
public int getEditorIconScale() {
return this.editorIconScale;
}
public void setEditorIconScale(int scale) {
this.editorIconScale = scale;
}
public int getTableIconScale() {
return this.tableIconScale;
}
public void setTableIconScale(int scale) {
this.tableIconScale = scale;
}
public void setLogExternalsOnly(boolean state) {
this.logExternalsOnly = state;
}
public boolean isLogExternalsOnly() {
return logExternalsOnly;
}
public boolean isCanBus() {
if (transportProtocol.equals(ISO15765)) {
return true;
}
return false;
}
public boolean isObdProtocol() {
if (loggerProtocol.equals(OBD)) {
return true;
}
return false;
}
public final boolean isUsNumberFormat() {
if (userLocale.equalsIgnoreCase(EN_US)) {
return true;
}
return false;
}
public final String getLocale() {
return userLocale;
}
public final void setLocale(String locale) {
userLocale = locale;
if (!locale.equalsIgnoreCase(SYSTEM_NUMFORMAT)) {
final String[] language = locale.split("_");
System.setProperty(USER_LANGUAGE, language[0]);
System.setProperty(USER_COUNTRY, language[1]);
final Locale lc = new Locale(language[0], language[1]);
Locale.setDefault(lc);
}
}
public boolean isOpenExpanded() {
return openExpanded;
}
public void setOpenExpanded(boolean expanded) {
this.openExpanded = expanded;
}
public boolean isShowTableToolbarBorder() {
return showTableToolbarBorder;
}
public void setShowTableToolbarBorder(boolean showBorder) {
this.showTableToolbarBorder = showBorder;
}
public boolean isAlwaysOpenTableAtZero() {
return alwaysOpenTableAtZero;
}
public void setAlwaysOpenTableAtZero(boolean openAtZero) {
this.alwaysOpenTableAtZero = openAtZero;
}
public boolean isScaleHeadersAndData() {
return this.scaleHeadersAndData;
}
public void setScaleHeadersAndData(boolean headersAndData) {
this.scaleHeadersAndData = headersAndData;
}
public boolean isColorAxis() {
return this.colorAxis;
}
public void setColorAxis(boolean colorAxis) {
this.colorAxis = colorAxis;
}
public String getDefaultScale() {
return this.defaultScale;
}
public void setDefaultScale(String defaultScale) {
this.defaultScale = defaultScale;
}
// public Map<String, IntfKitSensor> getPhidgetSensors() {
// return this.phidgetSensors;
// }
//
// public void setPhidgetSensors(
// Map<String, IntfKitSensor> phidgetSensors) {
//
// this.phidgetSensors = phidgetSensors;
// }
}

View File

@ -1,41 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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.
*/
// DO NOT EDIT. This file is automatically generated.
package com.romraider;
import javax.swing.ImageIcon;
public final class Version {
public static final String PRODUCT_NAME = "RomRaider";
public static final String VERSION = "0.5.8 RC 1 for rusEfi";
public static final String BUILDNUMBER = "635";
public static final String SUPPORT_URL = "http://www.rusefi.com";
// public static final String ROM_REVISION_URL = "http://www.scoobypedia.co.uk/index.php/Knowledge/ECUVersionCompatibilityList";
// public static final String ECU_DEFS_URL = "http://www.romraider.com/forum/topic360.html";
// public static final String LOGGER_DEFS_URL = "http://www.romraider.com/forum/topic1642.html";
public static final String CARS_DEFS_URL = "http://www.romraider.com/forum/topic5792.html";
public static final String RELEASE_NOTES = "release_notes.txt";
public static final ImageIcon ABOUT_ICON = new ImageIcon(Version.class.getClass().getResource( "/graphics/romraider-ico-large.gif" ));
public static final int MIN_LOG_DEF_VERSION = 155;
private Version() {
}
}

View File

@ -1,41 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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.
*/
// @warning.generated-file@
package com.romraider;
import javax.swing.ImageIcon;
public final class Version {
public static final String PRODUCT_NAME = "@name.package@";
public static final String VERSION = "@version.major@.@version.minor@.@version.patch@ @version.extra@ @version.extra1@";
public static final String BUILDNUMBER = "@version.buildnumber@";
public static final String SUPPORT_URL = "@supporturl@";
public static final String ROM_REVISION_URL = "@romrevisionurl@";
public static final String ECU_DEFS_URL = "@ecudefsurl@";
public static final String LOGGER_DEFS_URL = "@loggerdefsurl@";
public static final String CARS_DEFS_URL = "@carsdefsurl@";
public static final String RELEASE_NOTES = "@release_notes@";
public static final ImageIcon ABOUT_ICON = new ImageIcon(Version.class.getClass().getResource("/graphics/romraider-ico-large.gif"));
public static final int MIN_LOG_DEF_VERSION = @min.logger.def.version@;
private Version() {
}
}

View File

@ -1,726 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2014 RomRaider.com
*
* 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 com.romraider.editor.ecu;
//import static com.romraider.Version.ECU_DEFS_URL;
import static com.romraider.Version.PRODUCT_NAME;
import static com.romraider.Version.VERSION;
import static javax.swing.JOptionPane.DEFAULT_OPTION;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.showMessageDialog;
import static javax.swing.JOptionPane.showOptionDialog;
import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;
import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyVetoException;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.Vector;
import javax.management.modelmbean.XMLParseException;
import javax.naming.NameNotFoundException;
import javax.swing.ImageIcon;
import javax.swing.JCheckBox;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.SwingWorker;
import javax.swing.tree.TreePath;
import com.rusefi.ConsoleUI;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import com.romraider.Settings;
import com.romraider.maps.Rom;
import com.romraider.swing.CustomToolbarLayout;
import com.romraider.swing.ECUEditorMenuBar;
import com.romraider.swing.ECUEditorToolBar;
import com.romraider.swing.JProgressPane;
import com.romraider.swing.MDIDesktopPane;
import com.romraider.swing.RomTree;
import com.romraider.swing.RomTreeRootNode;
import com.romraider.swing.TableFrame;
import com.romraider.swing.TableToolBar;
import com.romraider.util.SettingsManager;
import com.romraider.xml.DOMRomUnmarshaller;
import com.romraider.xml.RomNotFoundException;
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
public class ECUEditor {
private final String titleText = PRODUCT_NAME + " v" + VERSION + " | ECU Editor";
private final RomTreeRootNode imageRoot = new RomTreeRootNode("Open Images");
private final RomTree imageList = new RomTree(imageRoot);
public MDIDesktopPane rightPanel = new MDIDesktopPane();
public JProgressPane statusPanel = new JProgressPane();
private JSplitPane splitPane = new JSplitPane();
private Rom lastSelectedRom = null;
private ECUEditorToolBar toolBar;
private ECUEditorMenuBar menuBar;
private TableToolBar tableToolBar;
private final JPanel toolBarPanel = new JPanel();
private OpenImageWorker openImageWorker;
private CloseImageWorker closeImageWorker;
private SetUserLevelWorker setUserLevelWorker;
private LaunchLoggerWorker launchLoggerWorker;
private final ImageIcon editorIcon = new ImageIcon(getClass().getResource( "/graphics/romraider-ico.gif" ), "RomRaider ECU Editor");
WindowListener wListenr = new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
handleExit();
}
};
JPanel content = new JPanel(new BorderLayout());
/*
AbstractFrame frame = new AbstractFrame() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
imageList.updateUI();
imageList.repaint();
rightPanel.updateUI();
rightPanel.repaint();
}
};
*/
public ECUEditor() {
Settings settings = SettingsManager.getSettings();
if (!settings.getRecentVersion().equalsIgnoreCase(VERSION)) {
showReleaseNotes();
}
// frame.setSize(settings.getWindowSize());
// frame.setLocation(settings.getWindowLocation());
// if (settings.isWindowMaximized()) {
// frame.setExtendedState(AbstractFrame.MAXIMIZED_BOTH);
// }
JScrollPane rightScrollPane = new JScrollPane(rightPanel,
VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
JScrollPane leftScrollPane = new JScrollPane(imageList,
VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftScrollPane, rightScrollPane);
splitPane.setDividerSize(3);
splitPane.setDividerLocation(settings.getSplitPaneLocation());
// splitPane.addPropertyChangeListener(frame);
splitPane.setContinuousLayout(true);
content.add(splitPane, BorderLayout.CENTER);
rightPanel.setBackground(Color.BLACK);
imageList.setScrollsOnExpand(true);
//frame.add(statusPanel, BorderLayout.SOUTH);
//set remaining window properties
// frame.setIconImage(editorIcon.getImage());
// frame.setDefaultCloseOperation(AbstractFrame.EXIT_ON_CLOSE);
ConsoleUI.getFrame().addWindowListener(wListenr);
// frame.setTitle(titleText);
// frame.setVisible(true);
// frame.toFront();
}
public static void openImage(byte[] fileContent) throws IOException, SAXException, RomNotFoundException, XMLParseException, NameNotFoundException {
openImage(fileContent, SettingsManager.getSettings().getEcuDefinitionFiles().elementAt(0), "rusEfi");
}
public JPanel getContent() {
return content;
}
public static void openImage(byte[] input, File definitionFile, String fileName) throws IOException, SAXException,
RomNotFoundException, XMLParseException, NameNotFoundException {
ECUEditor editor = ECUEditorManager.getECUEditor();
Rom rom = readRom(input, definitionFile, editor);
editor.getStatusPanel().setStatus("Populating tables...");
rom.setFullFileName(fileName);
rom.populateTables(input, editor.getStatusPanel());
editor.getStatusPanel().setStatus("Finalizing...");
editor.addRom(rom);
editor.refreshTableCompareMenus();
editor.getStatusPanel().setStatus("Done loading image...");
}
private static Rom readRom(byte[] romContent, File romDefinitionFile, ECUEditor editor) throws SAXException, IOException, RomNotFoundException, XMLParseException, NameNotFoundException {
DOMParser parser = new DOMParser();
Document doc;
FileInputStream fileStream;
fileStream = new FileInputStream(romDefinitionFile);
InputSource src = new InputSource(fileStream);
parser.parse(src);
doc = parser.getDocument();
Rom rom;
try {
rom = new DOMRomUnmarshaller().unmarshallXMLDefinition(doc.getDocumentElement(), romContent, editor.getStatusPanel());
} catch (RomNotFoundException e) {
throw new IllegalStateException("While reading " + romDefinitionFile.getName(), e);
} finally {
// Release mem after unmarshall.
parser.reset();
doc.removeChild(doc.getDocumentElement());
fileStream.close();
}
return rom;
}
public void initializeEditorUI() {
//create menubar
menuBar = new ECUEditorMenuBar();
// frame.setJMenuBar(menuBar);
// create toolbars
toolBar = new ECUEditorToolBar("Editor Tools");
tableToolBar = new TableToolBar();
tableToolBar.updateTableToolBar();
CustomToolbarLayout toolBarLayout = new CustomToolbarLayout(FlowLayout.LEFT, 0, 0);
toolBarPanel.setLayout(toolBarLayout);
toolBarPanel.add(toolBar);
toolBarPanel.add(tableToolBar);
toolBarPanel.setVisible(true);
content.add(toolBarPanel, BorderLayout.NORTH);
content.validate();
}
public void checkDefinitions() {
if (SettingsManager.getSettings().getEcuDefinitionFiles().size() <= 0) {
// no ECU definitions configured - let user choose to get latest or configure later
Object[] options = {"Yes", "No"};
int answer = showOptionDialog(null,
"ECU definitions not configured.\nGo online to download the latest definition files?",
"Editor Configuration",
DEFAULT_OPTION,
WARNING_MESSAGE,
null,
options,
options[0]);
if (answer == 0) {
// BrowserControl.displayURL(ECU_DEFS_URL);
} else {
showMessageDialog(ConsoleUI.getFrame(),
"ECU definition files need to be configured before ROM images can be opened.\nMenu: ECU Definitions > ECU Definition Manager...",
"Editor Configuration",
INFORMATION_MESSAGE);
}
}
}
private void showReleaseNotes() {
try {
BufferedReader br = new BufferedReader(new FileReader(SettingsManager.getSettings().getReleaseNotes()));
try {
// new version being used, display release notes
JTextArea releaseNotes = new JTextArea();
releaseNotes.setEditable(false);
releaseNotes.setWrapStyleWord(true);
releaseNotes.setLineWrap(true);
releaseNotes.setFont(new Font("Tahoma", Font.PLAIN, 12));
StringBuffer sb = new StringBuffer();
while (br.ready()) {
sb.append(br.readLine()).append(Settings.NEW_LINE);
}
releaseNotes.setText(sb.toString());
releaseNotes.setCaretPosition(0);
JScrollPane scroller = new JScrollPane(releaseNotes, VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_NEVER);
scroller.setPreferredSize(new Dimension(600, 500));
showMessageDialog(ConsoleUI.getFrame(), scroller,
PRODUCT_NAME + VERSION + " Release Notes", INFORMATION_MESSAGE);
} finally {
br.close();
}
} catch (Exception e) {
/* Ignore */
}
}
public void handleExit() {
Settings settings = SettingsManager.getSettings();
settings.setSplitPaneLocation(splitPane.getDividerLocation());
// settings.setWindowMaximized(frame.getExtendedState() == frame.MAXIMIZED_BOTH);
// settings.setWindowSize(frame.getSize());
// settings.setWindowLocation(frame.getLocation());
// Save when exit to save file settings.
SettingsManager.save(settings, statusPanel);
statusPanel.update("Ready...", 0);
content.repaint();
}
public String getVersion() {
return VERSION;
}
public void addRom(Rom input) {
Settings settings = SettingsManager.getSettings();
input.refreshDisplayedTables();
// add to ecu image list pane
getImageRoot().add(input);
getImageList().setVisible(true);
getImageList().expandPath(new TreePath(getImageRoot()));
getImageList().expandPath(new TreePath(input.getPath()));
if (!settings.isOpenExpanded()) {
imageList.collapsePath(new TreePath(input.getPath()));
}
getImageList().setRootVisible(false);
getImageList().repaint();
// Only set if no other rom has been selected.
if (null == getLastSelectedRom()) {
setLastSelectedRom(input);
}
if (input.getRomID().isObsolete() && settings.isObsoleteWarning()) {
JPanel infoPanel = new JPanel();
infoPanel.setLayout(new GridLayout(3, 1));
infoPanel.add(new JLabel("A newer version of this ECU revision exists. " +
"Please visit the following link to download the latest revision:"));
// infoPanel.add(new URL(settings.getRomRevisionURL()));
JCheckBox check = new JCheckBox("Always display this message", true);
check.setHorizontalAlignment(JCheckBox.RIGHT);
check.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SettingsManager.getSettings().setObsoleteWarning(((JCheckBox) e.getSource()).isSelected());
}
});
infoPanel.add(check);
showMessageDialog(ConsoleUI.getFrame(), infoPanel, "ECU Revision is Obsolete", INFORMATION_MESSAGE);
}
}
public void displayTable(TableFrame frame) {
try {
// check if frame has been added.
for (JInternalFrame curFrame : getRightPanel().getAllFrames()) {
if (curFrame.equals(frame)) {
// table is already open.
if (1 == SettingsManager.getSettings().getTableClickBehavior()) { // open/focus frame
// table is already open, so set focus on the frame.
boolean selected = true;
frame.toFront();
try {
frame.setSelected(true);
} catch (PropertyVetoException e) {
frame.toBack();
selected = false;
}
if (selected) {
frame.requestFocusInWindow();
}
} else { // default to open/close frame
// table is already open, so close the frame.
rightPanel.remove(frame);
frame.setVisible(false);
try {
frame.setClosed(true);
} catch (PropertyVetoException e) {
; // Do nothing.
}
frame.dispose();
}
frame.pack();
rightPanel.repaint();
return;
}
}
// frame not added. Draw table and add the frame.
frame.getTable().drawTable();
rightPanel.add(frame);
} catch (IllegalArgumentException ex) {
// Do nothing.
}
frame.pack();
rightPanel.repaint();
}
public void removeDisplayTable(TableFrame frame) {
frame.setVisible(false);
this.getTableToolBar().updateTableToolBar();
rightPanel.remove(frame);
rightPanel.validate();
refreshUI();
}
public void closeImage() {
ConsoleUI.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
closeImageWorker = new CloseImageWorker(getLastSelectedRom());
closeImageWorker.addPropertyChangeListener(getStatusPanel());
closeImageWorker.execute();
}
public void closeAllImages() {
while (imageRoot.getChildCount() > 0) {
closeImage();
}
}
public Rom getLastSelectedRom() {
return lastSelectedRom;
}
public String getLastSelectedRomFileName() {
Rom lastSelRom = getLastSelectedRom();
return lastSelRom == null ? "" : lastSelRom.getFileName() + " ";
}
public void setLastSelectedRom(Rom lastSelectedRom) {
this.lastSelectedRom = lastSelectedRom;
// if (lastSelectedRom == null) {
// frame.setTitle(titleText);
// } else {
// frame.setTitle(titleText + " - " + lastSelectedRom.getFileName());
// }
}
public ECUEditorToolBar getToolBar() {
return toolBar;
}
public void setToolBar(ECUEditorToolBar toolBar) {
this.toolBar = toolBar;
}
public ECUEditorMenuBar getEditorMenuBar() {
return menuBar;
}
public TableToolBar getTableToolBar() {
return tableToolBar;
}
public void redrawVisableTables(Settings settings) {
}
public void setUserLevel(int userLevel) {
content.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
SettingsManager.getSettings().setUserLevel(userLevel);
setUserLevelWorker = new SetUserLevelWorker();
setUserLevelWorker.addPropertyChangeListener(getStatusPanel());
setUserLevelWorker.execute();
}
public Vector<Rom> getImages() {
Vector<Rom> images = new Vector<>();
for (int i = 0; i < imageRoot.getChildCount(); i++) {
if (imageRoot.getChildAt(i) instanceof Rom) {
Rom rom = (Rom) imageRoot.getChildAt(i);
if (null != rom) {
images.add(rom);
}
}
}
return images;
}
public void refreshUI() {
getToolBar().updateButtons();
getEditorMenuBar().updateMenu();
getTableToolBar().updateTableToolBar();
imageList.updateUI();
imageList.repaint();
rightPanel.updateUI();
rightPanel.repaint();
}
public void refreshTableCompareMenus() {
for (int i = 0; i < imageRoot.getChildCount(); i++) {
if (imageRoot.getChildAt(i) instanceof Rom) {
Rom rom = (Rom) imageRoot.getChildAt(i);
if (null != rom) {
rom.refreshTableCompareMenus();
}
}
}
}
public void openImage(File inputFile) throws Exception {
ConsoleUI.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
openImageWorker = new OpenImageWorker(inputFile);
openImageWorker.addPropertyChangeListener(getStatusPanel());
openImageWorker.execute();
}
public static byte[] readFile(File inputFile) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (FileInputStream fis = new FileInputStream(inputFile)) {
byte[] buf = new byte[8192];
int bytesRead;
while ((bytesRead = fis.read(buf)) != -1) {
baos.write(buf, 0, bytesRead);
}
}
return baos.toByteArray();
}
public void launchLogger() {
ConsoleUI.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
// launchLoggerWorker = new LaunchLoggerWorker();
// launchLoggerWorker.addPropertyChangeListener(getStatusPanel());
// launchLoggerWorker.execute();
}
public RomTreeRootNode getImageRoot() {
return imageRoot;
}
public RomTree getImageList() {
return imageList;
}
public JProgressPane getStatusPanel() {
return this.statusPanel;
}
public MDIDesktopPane getRightPanel() {
return this.rightPanel;
}
}
class LaunchLoggerWorker extends SwingWorker<Void, Void> {
public LaunchLoggerWorker() {
}
@Override
protected Void doInBackground() throws Exception {
ECUEditor editor = ECUEditorManager.getECUEditor();
editor.getStatusPanel().setStatus("Launching Logger...");
setProgress(10);
// EcuLogger.startLogger(javax.swing.WindowConstants.DISPOSE_ON_CLOSE, editor);
return null;
}
public void propertyChange(PropertyChangeEvent evnt) {
SwingWorker source = (SwingWorker) evnt.getSource();
if (null != source && "state".equals(evnt.getPropertyName())
&& (source.isDone() || source.isCancelled())) {
source.removePropertyChangeListener(ECUEditorManager.getECUEditor().getStatusPanel());
}
}
@Override
public void done() {
ECUEditor editor = ECUEditorManager.getECUEditor();
editor.getStatusPanel().setStatus("Ready...");
setProgress(0);
ConsoleUI.getFrame().setCursor(null);
editor.refreshUI();
}
}
class SetUserLevelWorker extends SwingWorker<Void, Void> {
public SetUserLevelWorker() {
}
@Override
protected Void doInBackground() throws Exception {
for (Rom rom : ECUEditorManager.getECUEditor().getImages()) {
rom.refreshDisplayedTables();
}
return null;
}
public void propertyChange(PropertyChangeEvent evnt) {
SwingWorker source = (SwingWorker) evnt.getSource();
if (null != source && "state".equals(evnt.getPropertyName())
&& (source.isDone() || source.isCancelled())) {
source.removePropertyChangeListener(ECUEditorManager.getECUEditor().getStatusPanel());
}
}
@Override
public void done() {
ECUEditor editor = ECUEditorManager.getECUEditor();
editor.getStatusPanel().setStatus("Ready...");
setProgress(0);
ConsoleUI.getFrame().setCursor(null);
editor.refreshUI();
}
}
class CloseImageWorker extends SwingWorker<Void, Void> {
Rom rom;
public CloseImageWorker(Rom romToRemove) {
this.rom = romToRemove;
}
@Override
protected Void doInBackground() throws Exception {
ECUEditor editor = ECUEditorManager.getECUEditor();
RomTreeRootNode imageRoot = editor.getImageRoot();
rom.clearData();
rom.removeFromParent();
rom = null;
if (imageRoot.getChildCount() > 0) {
editor.setLastSelectedRom((Rom) imageRoot.getChildAt(0));
} else {
// no other images open
editor.setLastSelectedRom(null);
}
editor.refreshTableCompareMenus();
return null;
}
@Override
public void done() {
ECUEditor editor = ECUEditorManager.getECUEditor();
editor.getStatusPanel().setStatus("Ready...");
setProgress(0);
ConsoleUI.getFrame().setCursor(null);
editor.refreshUI();
System.gc();
}
}
class OpenImageWorker extends SwingWorker<Void, Void> {
private final File inputFile;
public OpenImageWorker(File inputFile) {
this.inputFile = inputFile;
}
@Override
protected Void doInBackground() throws Exception {
ECUEditor editor = ECUEditorManager.getECUEditor();
Settings settings = SettingsManager.getSettings();
try {
editor.getStatusPanel().setStatus("Parsing ECU definitions...");
setProgress(0);
byte[] input = ECUEditor.readFile(inputFile);
editor.getStatusPanel().setStatus("Finding ECU definition...");
setProgress(10);
// parse ecu definition files until result found
for (int i = 0; i < settings.getEcuDefinitionFiles().size(); i++) {
File definitionFile = settings.getEcuDefinitionFiles().get(i);
try {
ECUEditor.openImage(input, definitionFile, inputFile.getName());
setProgress(100);
return null;
} catch (RomNotFoundException rex) {
// rom was not found in current file, skip to next
}
}
// if code executes to this point, no ROM was found, report to user
showMessageDialog(ConsoleUI.getFrame(), "ECU Definition Not Found", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
} catch (SAXParseException spe) {
// catch general parsing exception - enough people don't unzip the defs that a better error message is in order
showMessageDialog(ConsoleUI.getFrame(), "Unable to read XML definitions. Please make sure the definition file is correct. If it is in a ZIP archive, unzip the file and try again.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
} catch (StackOverflowError ex) {
// handles looped inheritance, which will use up all available memory
showMessageDialog(ConsoleUI.getFrame(), "Looped \"base\" attribute in XML definitions.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
} catch (OutOfMemoryError ome) {
// handles Java heap space issues when loading multiple Roms.
showMessageDialog(ConsoleUI.getFrame(), "Error loading Image. Out of memeory.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
} catch (Exception ex) {
ex.printStackTrace();
showMessageDialog(ConsoleUI.getFrame(), "Error Loading. Unknown Exception.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
}
return null;
}
public void propertyChange(PropertyChangeEvent evnt) {
SwingWorker source = (SwingWorker) evnt.getSource();
if (null != source && "state".equals(evnt.getPropertyName())
&& (source.isDone() || source.isCancelled())) {
source.removePropertyChangeListener(ECUEditorManager.getECUEditor().getStatusPanel());
}
}
@Override
public void done() {
ECUEditor editor = ECUEditorManager.getECUEditor();
editor.getStatusPanel().setStatus("Ready...");
setProgress(0);
ConsoleUI.getFrame().setCursor(null);
editor.refreshUI();
System.gc();
}
}

View File

@ -1,47 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.editor.ecu;
import com.rusefi.ui.util.UiUtils;
public class ECUEditorManager {
private static ECUEditor editor = null;
private ECUEditorManager() {
throw new UnsupportedOperationException();
}
public static ECUEditor getECUEditor() {
if (editor == null) {
try {
UiUtils.invokeAndWait(new Runnable() {
public void run() {
editor = new ECUEditor();
}
});
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return editor;
}
}

View File

@ -1,32 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.io.connection;
import com.romraider.logger.ecu.comms.manager.PollingState;
public interface ConnectionManager {
void send(byte[] request, byte[] response, PollingState pollState);
byte[] send(byte[] bytes);
void clearLine();
void close();
}

View File

@ -1,36 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.io.connection;
public interface ConnectionProperties {
int getBaudRate();
void setBaudRate(int b);
int getDataBits();
int getStopBits();
int getParity();
int getConnectTimeout();
int getSendTimeout();
}

View File

@ -1,82 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.io.connection;
public final class ConnectionPropertiesImpl implements ConnectionProperties {
private final int baudRate;
private final int dataBits;
private final int stopBits;
private final int parity;
private final int connectTimeout;
private final int sendTimeout;
public ConnectionPropertiesImpl(int baudRate, int dataBits, int stopBits, int parity, int connectTimeout, int sendTimeout) {
this.baudRate = baudRate;
this.dataBits = dataBits;
this.stopBits = stopBits;
this.parity = parity;
this.connectTimeout = connectTimeout;
this.sendTimeout = sendTimeout;
}
public int getBaudRate() {
return baudRate;
}
public void setBaudRate(int b) {
}
public int getDataBits() {
return dataBits;
}
public int getStopBits() {
return stopBits;
}
public int getParity() {
return parity;
}
public int getConnectTimeout() {
return connectTimeout;
}
public int getSendTimeout() {
return sendTimeout;
}
public String toString() {
final String properties = String.format(
"%s[baudRate=%d, dataBits=%d, stopBits=%d, parity=%d, " +
"connectTimeout=%d, sendTimeout=%d]",
getClass().getSimpleName(),
getBaudRate(),
getDataBits(),
getStopBits(),
getParity(),
getConnectTimeout(),
getSendTimeout()
);
return properties;
}
}

View File

@ -1,40 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.car.util;
public enum Constants {
IMPERIAL ("imperial"),
IMPERIAL_UNIT ("mph"),
METRIC ("metric"),
METRIC_UNIT ("km/h"),
KPH_2_MPH ("1.609344"),
TQ_CONSTANT_I ("5252.113122"),
TQ_CONSTANT_M ("9549.296748");
private final String value;
Constants (String value) {
this.value = value;
}
public String value(){
return value;
}
}

View File

@ -1,44 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.car.util;
import static com.romraider.logger.car.util.Constants.IMPERIAL_UNIT;
import static com.romraider.logger.car.util.Constants.KPH_2_MPH;
import static com.romraider.logger.car.util.Constants.METRIC_UNIT;
public class SpeedCalculator {
private static final double K2M = Double.parseDouble(KPH_2_MPH.value());
public static double calculateMph(double rpm, double ratio) {
return (rpm / ratio);
}
public static double calculateKph(double rpm, double ratio) {
return calculateMph(rpm, ratio) * K2M;
}
public static double calculateRpm(double vs, double ratio, String units) {
double rpm = 0;
if (units.equalsIgnoreCase(IMPERIAL_UNIT.value())) rpm = (vs * ratio);
if (units.equalsIgnoreCase(METRIC_UNIT.value())) rpm = (vs * ratio / K2M);
return rpm;
}
}

View File

@ -1,39 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.car.util;
import static com.romraider.logger.car.util.Constants.IMPERIAL;
import static com.romraider.logger.car.util.Constants.METRIC;
import static com.romraider.logger.car.util.Constants.TQ_CONSTANT_I;
import static com.romraider.logger.car.util.Constants.TQ_CONSTANT_M;
public class TorqueCalculator {
public static double calculateTorque(double rpm, double hp, String units) {
double tq = 0;
if (units.equalsIgnoreCase(IMPERIAL.value())) {
tq = hp / rpm * Double.parseDouble(TQ_CONSTANT_I.value());
}
if (units.equalsIgnoreCase(METRIC.value())) {
tq = hp / rpm * Double.parseDouble(TQ_CONSTANT_M.value());
}
return tq;
}
}

View File

@ -1,47 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu;
import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
import com.romraider.swing.LookAndFeelManager;
import com.romraider.util.LogManager;
public final class EcuLoggerExec {
private EcuLoggerExec() {
throw new UnsupportedOperationException();
}
public static void main(String... args) {
// init debug loging
LogManager.initDebugLogging();
// check for dodgy threading - dev only
// RepaintManager.setCurrentManager(new ThreadCheckingRepaintManager(true));
// set look and feel
LookAndFeelManager.initLookAndFeel();
// start logger
// EcuLogger.startLogger(EXIT_ON_CLOSE, args);
}
}

View File

@ -1,26 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.learning;
public interface LearningTableValues {
void execute();
}

View File

@ -1,88 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.learning.parameter;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
* This Emun defines all the possible parameters used to query the Learning
* Table Values of an ECU.
*/
public enum Parameter {
E1("E1"), // IAM 16 bit
E31("E31"), // IAM 32 bit
E12("E12"), // Fine Learning Knock Correction*
E41("E41"), // Fine Learning Knock Correction (4-byte)*
E13("E13"), // AF Learning 1A 16 bit
E14("E14"), // AF Learning 1B 16 bit
E15("E15"), // AF Learning 1C 16 bit
E16("E16"), // AF Learning 1D 16 bit
E44("E44"), // AF Learning 1A 32 bit
E45("E45"), // AF Learning 1B 32 bit
E46("E46"), // AF Learning 1C 32 bit
E47("E47"), // AF Learning 1D 32 bit
E62("E62"), // AF Learning 2A 32 bit
E63("E63"), // AF Learning 2B 32 bit
E64("E64"), // AF Learning 2C 32 bit
E65("E65"), // AF Learning 2D 32 bit
P2("P2"), // ECT
P11("P11"), // IAT
P17("P17"), // Battery Volts
P24("P24"), // ATM
P66("P66"), // AF Learning 3
P115("P115"), // Learned Throttle Closed Voltage
P118("P118"), // AF Learning 4
P153("P153"), // Whole Learning value in timing
E173("E173"); // Fine Learning Knock Correction Table Start (4-byte)*
private static final Map<String, Parameter> lookup
= new HashMap<String, Parameter>();
static {
for(Parameter s : EnumSet.allOf(Parameter.class))
lookup.put(s.toString(), s);
}
private Parameter(final String text) {
this.text = text;
}
private final String text;
@Override
public final String toString() {
return text;
}
/**
* Retrieve the Parameter that has the given value.
* @param value - the value of the Parameter in String format
* @return the Parameter that has the given value or null if undefined.
*/
public static Parameter fromValue(String value) {
Parameter result = null;
if (lookup.containsKey(value)) {
result = lookup.get(value);
}
return result;
}
}

View File

@ -1,64 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.learning.parameter;
import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.E1;
import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.E31;
import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P11;
import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P115;
import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P118;
import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P153;
import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P17;
import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P2;
import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P24;
import static com.romraider.logger.ecu.comms.learning.parameter.Parameter.P66;
import java.util.HashMap;
import java.util.Map;
/**
* A Map of Parameter and value specific to the Vehicle Information Table.
*/
public class ParameterCrossReference {
final Map<Parameter, String> map;
public ParameterCrossReference() {
map = new HashMap<Parameter, String>();
map.put(P17, "Battery");
map.put(P24, "ATM");
map.put(P11, "IAT");
map.put(P2, "ECT");
map.put(E1, "IAM");
map.put(E31, "IAM");
map.put(P66, "A/F #3");
map.put(P118, "A/F #4");
map.put(P115, "TPS VDC");
map.put(P153, "Lrn Timing");
}
/**
* Retrieve the string value associated with the supplied Parameter.
* @param parameter - Parameter to lookup value for.
* @return the value of the Parameter.
*/
public final String getValue(Parameter parameter) {
return map.get(parameter);
}
}

View File

@ -1,35 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.learning.parameter;
import java.util.Comparator;
import com.romraider.logger.ecu.comms.query.EcuQuery;
/**
* A custom comparator to sort EcuQuery items based on an encapsulated ID field.
*/
public final class ParameterIdComparator implements Comparator<EcuQuery> {
public int compare(EcuQuery ecuQuery1, EcuQuery ecuQuery2) {
return ecuQuery1.getLoggerData().getId().compareTo(
ecuQuery2.getLoggerData().getId());
}
}

View File

@ -1,44 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.manager;
public interface PollingState {
int getCurrentState();
void setCurrentState(int i);
int getLastState();
void setLastState(int i);
boolean isNewQuery();
void setNewQuery(boolean state);
boolean isLastQuery();
void setLastQuery(boolean state);
boolean isFastPoll();
void setFastPoll(boolean state);
}

View File

@ -1,89 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.manager;
public final class PollingStateImpl implements PollingState {
private static int currentState;
private static int lastpollState;
private static boolean newQuery;
private static boolean lastQuery;
private static boolean fastPoll;
public PollingStateImpl() {
setCurrentState(0);
setLastState(0);
setNewQuery(true);
setLastQuery(false);
setFastPoll(false);
}
public int getCurrentState() {
return currentState;
}
public void setCurrentState(int i) {
currentState = i;
}
public int getLastState() {
return lastpollState;
}
public void setLastState(int i) {
lastpollState = i;
}
public boolean isNewQuery() {
return newQuery;
}
public void setNewQuery(boolean state) {
newQuery = state;
}
public boolean isLastQuery() {
return lastQuery;
}
public void setLastQuery(boolean state) {
lastQuery = state;
}
public boolean isFastPoll() {
return fastPoll;
}
public void setFastPoll(boolean state) {
fastPoll = state;
}
public String toString() {
final String state = String.format(
"Polling State [isFastPoll=%s, CurrentState=%d, LastState=%d, " +
"isNewQuery=%s, isLastQuery=%s]",
isFastPoll(),
getCurrentState(),
getLastState(),
isNewQuery(),
isLastQuery()
);
return state;
}
}

View File

@ -1,35 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.manager;
import com.romraider.logger.ecu.comms.query.EcuQuery;
import java.util.Collection;
public interface TransmissionManager {
void start();
void sendQueries(Collection<EcuQuery> queries, PollingState pollMode);
void endQueries();
void stop();
}

View File

@ -1,76 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.manager;
//import static com.romraider.logger.ecu.comms.io.connection.LoggerConnectionFactory.getConnection;
import static com.romraider.util.ParamChecker.checkNotNull;
import static org.apache.log4j.Logger.getLogger;
import java.util.Collection;
import org.apache.log4j.Logger;
import com.romraider.Settings;
//import com.romraider.logger.ecu.comms.io.connection.LoggerConnection;
import com.romraider.logger.ecu.comms.query.EcuQuery;
import com.romraider.logger.ecu.exception.NotConnectedException;
import com.romraider.util.SettingsManager;
public final class TransmissionManagerImpl implements TransmissionManager {
private static final Logger LOGGER = getLogger(TransmissionManagerImpl.class);
// private LoggerConnection connection;
public TransmissionManagerImpl() {
}
@Override
public void start() {
try {
Settings settings = SettingsManager.getSettings();
// connection = getConnection(settings.getLoggerProtocol(), settings.getLoggerPort(), settings.getLoggerConnectionProperties());
LOGGER.info("TX Manager Started.");
} catch (Throwable e) {
stop();
}
}
@Override
public void sendQueries(Collection<EcuQuery> queries, PollingState pollState) {
checkNotNull(queries, "queries");
checkNotNull(pollState, "pollState");
// if (connection == null) throw new NotConnectedException("TransmissionManager must be started before queries can be sent!");
// connection.sendAddressReads(queries, SettingsManager.getSettings().getDestinationId(), pollState);
}
@Override
public void endQueries() {
// if (connection == null) throw new NotConnectedException("TransmissionManager must be started before ending queries!");
// connection.clearLine();
}
@Override
public void stop() {
// if (connection != null) {
// endQueries();
//// connection.close();
// }
LOGGER.info("TX Manager Stopped.");
}
}

View File

@ -1,28 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.query;
public interface EcuInit {
String getEcuId();
byte[] getEcuInitBytes();
}

View File

@ -1,26 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.query;
public interface EcuInitCallback {
void callback(EcuInit ecuInit);
}

View File

@ -1,31 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.query;
public interface EcuQuery extends Query {
String[] getAddresses();
byte[] getBytes();
String getHex();
void setResponse(byte[] bytes);
}

View File

@ -1,75 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.query;
import com.romraider.logger.ecu.definition.EcuData;
import com.romraider.logger.ecu.definition.LoggerData;
import static com.romraider.util.HexUtil.asHex;
import static com.romraider.util.ParamChecker.checkNotNull;
public final class EcuQueryImpl implements EcuQuery {
private final EcuData ecuData;
private final byte[] bytes;
private final String hex;
private double response;
public EcuQueryImpl(EcuData ecuData) {
checkNotNull(ecuData);
this.ecuData = ecuData;
bytes = ecuData.getAddress().getBytes();
hex = asHex(bytes);
}
public LoggerData getLoggerData() {
return ecuData;
}
public String[] getAddresses() {
return ecuData.getAddress().getAddresses();
}
public byte[] getBytes() {
return bytes;
}
public String getHex() {
return hex;
}
public double getResponse() {
return response;
}
public void setResponse(byte[] bytes) {
this.response = ecuData.getSelectedConvertor().convert(bytes);
}
public boolean equals(Object object) {
return object instanceof EcuQueryImpl && getHex().equals(((EcuQueryImpl) object).getHex());
}
public int hashCode() {
return getHex().hashCode();
}
public String toString() {
return "0x" + getHex();
}
}

View File

@ -1,26 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.query;
public interface ExternalQuery extends Query {
void setResponse(double response);
}

View File

@ -1,46 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.query;
import com.romraider.logger.ecu.definition.ExternalData;
import com.romraider.logger.ecu.definition.LoggerData;
import static com.romraider.util.ParamChecker.checkNotNull;
public final class ExternalQueryImpl implements ExternalQuery {
private final ExternalData externalData;
private double response;
public ExternalQueryImpl(ExternalData externalData) {
checkNotNull(externalData);
this.externalData = externalData;
}
public LoggerData getLoggerData() {
return externalData;
}
public void setResponse(double response) {
this.response = response;
}
public double getResponse() {
return response;
}
}

View File

@ -1,30 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.query;
import com.romraider.logger.ecu.definition.LoggerData;
public interface Query {
LoggerData getLoggerData();
double getResponse();
}

View File

@ -1,34 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.query;
import com.romraider.logger.ecu.definition.LoggerData;
import java.util.Set;
public interface Response {
void setDataValue(LoggerData data, double value);
Set<LoggerData> getData();
double getDataValue(LoggerData data);
long getTimestamp();
}

View File

@ -1,52 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.query;
import com.romraider.logger.ecu.definition.LoggerData;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
public class ResponseImpl implements Response {
private static final double ZERO = 0.0;
private final Map<LoggerData, Double> dataValues = new LinkedHashMap<LoggerData, Double>();
private final long timestamp;
public ResponseImpl() {
timestamp = System.currentTimeMillis();
}
public void setDataValue(LoggerData data, double value) {
dataValues.put(data, value);
}
public Set<LoggerData> getData() {
return dataValues.keySet();
}
public double getDataValue(LoggerData data) {
final Double value = dataValues.get(data);
return value == null ? ZERO : value;
}
public long getTimestamp() {
return timestamp;
}
}

View File

@ -1,46 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.query;
import static com.romraider.util.HexUtil.asHex;
import static com.romraider.util.ParamChecker.checkNotNullOrEmpty;
import static java.lang.System.arraycopy;
public final class SSMEcuInit implements EcuInit {
private byte[] ecuInitBytes;
private String ecuId;
public SSMEcuInit(byte[] ecuInitBytes) {
checkNotNullOrEmpty(ecuInitBytes, "ecuInitBytes");
this.ecuInitBytes = ecuInitBytes;
byte[] ecuIdBytes = new byte[5];
arraycopy(ecuInitBytes, 3, ecuIdBytes, 0, 5);
ecuId = asHex(ecuIdBytes);
}
public String getEcuId() {
return ecuId;
}
public byte[] getEcuInitBytes() {
return ecuInitBytes;
}
}

View File

@ -1,25 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.readcodes;
public interface ReadCodesManager {
int readCodes();
}

View File

@ -1,24 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.comms.reset;
public interface ResetManager {
boolean resetEcu();
}

View File

@ -1,26 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
public interface ConvertorUpdateListener {
void notifyConvertorUpdate(LoggerData updatedLoggerData);
}

View File

@ -1,31 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
public interface EcuAddress {
String[] getAddresses();
byte[] getBytes();
int getBit();
int getLength();
}

View File

@ -1,123 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
import static com.romraider.util.HexUtil.asBytes;
import static com.romraider.util.HexUtil.hexToInt;
import static com.romraider.util.HexUtil.intToHexString;
import static com.romraider.util.ParamChecker.checkGreaterThanZero;
import static com.romraider.util.ParamChecker.checkNotNullOrEmpty;
import java.util.LinkedList;
import java.util.List;
public final class EcuAddressImpl implements EcuAddress {
private final String[] addresses;
private final byte[] bytes;
private final int bit;
public EcuAddressImpl(String address, int length, int bit) {
checkNotNullOrEmpty(address, "address");
checkGreaterThanZero(length, "length");
final String[] addrSting = {address};
this.addresses = buildAddresses(addrSting, length);
this.bytes = getAddressBytes(addresses);
this.bit = bit;
}
public EcuAddressImpl(String[] address, int length, int bit) {
checkNotNullOrEmpty(address, "address");
checkGreaterThanZero(length, "length");
this.addresses = buildAddresses(address, length);
this.bytes = getAddressBytes(addresses);
this.bit = bit;
}
public EcuAddressImpl(String[] addresses) {
checkNotNullOrEmpty(addresses, "addresses");
this.addresses = addresses;
this.bytes = getAddressBytes(addresses);
this.bit = -1;
}
public String[] getAddresses() {
return addresses;
}
public byte[] getBytes() {
return bytes;
}
public int getBit() {
return bit;
}
public int getLength() {
return addresses.length;
}
private String[] buildAddresses(String[] startAddress, int addressLength) {
final List<String> addresses = new LinkedList<String>();
if (startAddress.length > addressLength) {
for (int i = 0; i < startAddress.length; i++) {
final int address = hexToInt(startAddress[i]);
addresses.add(
padAddress(intToHexString(address),
startAddress[i].length()));
}
}
else {
int start = hexToInt(startAddress[0]);
for (int i = 0; i < addressLength; i++) {
addresses.add(
padAddress(intToHexString(start + i),
startAddress[0].length()));
}
}
return addresses.toArray(new String[addresses.size()]);
}
private String padAddress(String address, int length) {
if (address.length() == length) {
return address;
} else {
StringBuilder builder = new StringBuilder(length);
builder.append("0x");
String s = address.substring(2);
for (int i = 0; i < length - s.length() - 2; i++) {
builder.append('0');
}
builder.append(s);
return builder.toString();
}
}
private byte[] getAddressBytes(String[] addresses) {
byte[] bytes = new byte[0];
for (String address : addresses) {
byte[] tmp1 = asBytes(address);
byte[] tmp2 = new byte[bytes.length + tmp1.length];
System.arraycopy(bytes, 0, tmp2, 0, bytes.length);
System.arraycopy(tmp1, 0, tmp2, bytes.length, tmp1.length);
bytes = tmp2;
}
return bytes;
}
}

View File

@ -1,26 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
public interface EcuData extends LoggerData {
EcuAddress getAddress();
}

View File

@ -1,39 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2014 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
public interface EcuDataConvertor {
double convert(byte[] bytes);
String format(double value);
String getUnits();
//GaugeMinMax getGaugeMinMax();
String getFormat();
String getExpression();
String getDataType();
}

View File

@ -1,26 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
public enum EcuDataType {
PARAMETER,
SWITCH,
EXTERNAL
}

View File

@ -1,35 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
import java.io.File;
public interface EcuDefinition {
String getEcuId();
String getCalId();
String getCarString();
String getInherits();
File getEcuDefFile();
}

View File

@ -1,67 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
import static com.romraider.util.ParamChecker.checkNotNullOrEmpty;
import java.io.File;
public final class EcuDefinitionImpl implements EcuDefinition {
private final String ecuId;
private final String calId;
private final String carString;
private final String inherits;
private final File ecuDefFile;
public EcuDefinitionImpl(
String ecuId, String calId, String carString,
String inherits, File ecuDefFile) {
checkNotNullOrEmpty(ecuId, "ecuId");
checkNotNullOrEmpty(calId, "calId");
checkNotNullOrEmpty(carString, "carString");
this.ecuId = ecuId;
this.calId = calId;
this.carString = carString;
this.inherits = inherits;
this.ecuDefFile = ecuDefFile;
}
public String getEcuId() {
return ecuId;
}
public String getCalId() {
return calId;
}
public String getCarString() {
return carString;
}
public String getInherits() {
return inherits;
}
public File getEcuDefFile() {
return ecuDefFile;
}
}

View File

@ -1,26 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
public interface EcuDerivedParameterConvertor extends EcuDataConvertor {
void setEcuDatas(EcuData[] ecuDatas);
}

View File

@ -1,26 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
public interface EcuParameter extends EcuData {
void addConvertorUpdateListener(ConvertorUpdateListener listener);
}

View File

@ -1,24 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
public interface EcuSwitch extends EcuData {
}

View File

@ -1,51 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
import java.util.Map;
import com.romraider.util.ParamChecker;
/**
* From the ECU Definition Map retrieve the definition for the current ECU ID.
*/
public final class EvaluateEcuDefinition {
public EvaluateEcuDefinition() {
}
/**
* Retrieve the definition for the current ECU ID.
* @param ecuDefMap - a map of ECU Definitions keyed by ECU ID.
* @param ecuId - the ECU ID to find the ECU Definition for.
* @return an ECU Definition or a New ECU Definition with all but the ECU ID set
* to "unknown".
*/
public final EcuDefinition getDef(
Map<String, EcuDefinition> ecuDefMap, String ecuId) {
ParamChecker.checkNotNull(ecuDefMap, "EcuDefinitionMap");
EcuDefinition ecuDef = ecuDefMap.get(ecuId);
if (ecuDef == null) {
ecuDef = new EcuDefinitionImpl(
ecuId, "unknown", "unknown", "unknown", null);
}
return ecuDef;
}
}

View File

@ -1,26 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
public interface ExternalData extends LoggerData {
void addConvertorUpdateListener(ConvertorUpdateListener listener);
}

View File

@ -1,39 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition;
public interface LoggerData {
String getId();
String getName();
String getDescription();
EcuDataConvertor getSelectedConvertor();
EcuDataConvertor[] getConvertors();
void selectConvertor(EcuDataConvertor convertor);
boolean isSelected();
void setSelected(boolean selected);
}

View File

@ -1,30 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition.plugin;
import java.io.File;
import java.io.FilenameFilter;
public final class PluginFilenameFilter implements FilenameFilter {
public boolean accept(File dir, String filename) {
return filename.endsWith(".plugin");
}
}

View File

@ -1,70 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition.xml;
import java.io.FileInputStream;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import com.romraider.logger.ecu.definition.EcuDefinition;
/**
* Parse a given XML definition file into a DOM.
*/
public class EcuDefinitionDocumentLoader {
private EcuDefinitionDocumentLoader() {
}
/**
* Parse a given XML definition file into a DOM.
* @param ecuDef - an ECU Definition containing a File to parse.
* @return a DOM.
*/
public static final Document getDocument(EcuDefinition ecuDef) {
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
try {
builder = dbf.newDocumentBuilder();
}
catch (ParserConfigurationException e) {
e.printStackTrace();
}
Document document = null;
try {
document = builder.parse(
new FileInputStream(ecuDef.getEcuDefFile()));
}
catch (SAXException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
return document;
}
}

View File

@ -1,256 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition.xml;
import com.romraider.logger.ecu.definition.EcuDefinition;
import com.romraider.logger.ecu.definition.EcuDefinitionImpl;
import static com.romraider.util.ParamChecker.isNullOrEmpty;
import org.apache.log4j.Logger;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
/*
<rom base="16BITBASE">
<romid>
<xmlid>CAL ID:A4TC300K</xmlid>
<internalidaddress>200</internalidaddress>
<internalidstring>A4TC300K</internalidstring>
<year>03</year>
<transmission>AT</transmission>
<ecuid>3614446205</ecuid>
</romid>
</rom>
*/
public final class EcuDefinitionHandler extends DefaultHandler {
private static final Logger LOGGER = Logger.getLogger(EcuDefinitionHandler.class);
private static final String TAG_ROM = "rom";
private static final String TAG_ROMID = "romid";
private static final String TAG_CALID = "internalidstring";
private static final String TAG_ECUID = "ecuid";
private static final String TAG_CASEID = "caseid";
private static final String TAG_ADDRESS = "internalidaddress";
private static final String TAG_YEAR = "year";
private static final String TAG_MARKET = "market";
private static final String TAG_MAKE = "make";
private static final String TAG_MODEL = "model";
private static final String TAG_SUBMODEL = "submodel";
private static final String TAG_TRANS = "transmission";
private static final String TAG_MEMMODEL = "memmodel";
private static final String TAG_FLASH = "flashmethod";
private static final String TAG_SIZE = "filesize";
private static final String TAG_OBSOLETE = "obsolete";
private static final String ATTR_BASE = "base";
private Map<String, EcuDefinition> ecuDefinitionMap = new HashMap<String, EcuDefinition>();
private String calId;
private String ecuId;
private String caseId;
private String address;
private String year;
private String market;
private String make;
private String model;
private String submodel;
private String transmission;
private String memmodel;
private String flashmethod;
private String filesize;
private String obsolete;
private String inherit;
private String carString;
private StringBuilder charBuffer;
private File ecuDefsFile;
public EcuDefinitionHandler(File ecuDefsFile) {
this.ecuDefsFile = ecuDefsFile;
}
public void startDocument() {
ecuDefinitionMap = new HashMap<String, EcuDefinition>();
}
public void startElement(String uri, String localName, String qName, Attributes attributes) {
if (TAG_ROM.equals(qName)) {
inherit = attributes.getValue(ATTR_BASE);
}
else if (TAG_ROMID.equals(qName)) {
calId = "";
ecuId = "";
caseId = "";
address = "";
year = "";
market = "";
make = "";
model = "";
submodel = "";
transmission = "";
memmodel = "";
flashmethod = "";
filesize = "";
obsolete = "0";
carString = "";
}
charBuffer = new StringBuilder();
}
public void characters(char[] ch, int start, int length) {
charBuffer.append(ch, start, length);
}
public void endElement(String uri, String localName, String qName) {
if (TAG_ROM.equals(qName)) {
inherit = null;
}
else if (TAG_ROMID.equals(qName)) {
if (!isNullOrEmpty(ecuId) &&
!isNullOrEmpty(calId) &&
!isNullOrEmpty(year) &&
!isNullOrEmpty(market) &&
!isNullOrEmpty(make) &&
!isNullOrEmpty(model) &&
!isNullOrEmpty(submodel) &&
!isNullOrEmpty(transmission)
) {
carString = String.format("%s %s %s %s %s %s",
year, market, make, model, submodel, transmission);
ecuDefinitionMap.put(ecuId,
new EcuDefinitionImpl(
ecuId, calId, carString, inherit, ecuDefsFile));
}
if (!isNullOrEmpty(ecuId) &&
!isNullOrEmpty(calId) &&
!isNullOrEmpty(address) &&
!isNullOrEmpty(year) &&
!isNullOrEmpty(market) &&
!isNullOrEmpty(make) &&
!isNullOrEmpty(model) &&
!isNullOrEmpty(submodel) &&
!isNullOrEmpty(transmission) &&
!isNullOrEmpty(memmodel) &&
!isNullOrEmpty(flashmethod) &&
!isNullOrEmpty(obsolete)
) {
LOGGER.debug(romDetail());
}
}
else if (TAG_CALID.equals(qName)) {
calId = charBuffer.toString();
}
else if (TAG_ECUID.equals(qName)) {
ecuId = charBuffer.toString();
}
else if (TAG_CASEID.equals(qName)) {
caseId = charBuffer.toString();
}
else if (TAG_ADDRESS.equals(qName)) {
address = charBuffer.toString();
}
else if (TAG_YEAR.equals(qName)) {
year = charBuffer.toString();
if (!year.isEmpty()) {
try {
if (Integer.parseInt(year) < 90) {
year = "20" + year;
}
}
catch (NumberFormatException e) {
if ((year.contains("/") || year.contains("-")) &&
year.length() < 6 )
year = "20" + year;
}
}
else {
year = "20xx";
}
}
else if (TAG_MARKET.equals(qName)) {
market = charBuffer.toString();
}
else if (TAG_MAKE.equals(qName)) {
make = charBuffer.toString();
}
else if (TAG_MODEL.equals(qName)) {
model = charBuffer.toString();
}
else if (TAG_SUBMODEL.equals(qName)) {
submodel = charBuffer.toString();
}
else if (TAG_TRANS.equals(qName)) {
transmission = charBuffer.toString();
}
else if (TAG_MEMMODEL.equals(qName)) {
memmodel = charBuffer.toString();
}
else if (TAG_FLASH.equals(qName)) {
flashmethod = charBuffer.toString();
}
else if (TAG_SIZE.equals(qName)) {
filesize = charBuffer.toString();
}
else if (TAG_OBSOLETE.equals(qName)) {
obsolete = charBuffer.toString();
}
}
public Map<String, EcuDefinition> getEcuDefinitionMap() {
return ecuDefinitionMap;
}
public String romDetail() {
return String.format(
"calid='%s'," +
"address='%s'," +
"string='%s'," +
"caseid='%s'," +
"year='%s'," +
"market='%s'," +
"make='%s'," +
"model='%s'," +
"submodel='%s'," +
"transmission='%s'," +
"memmodel='%s'," +
"flash='%s'," +
"filesize='%s'," +
"obsolete='%s'," +
"inherit='%s'" +
"file='%s'",
calId,
address,
calId,
caseId,
year,
market,
make,
model,
submodel,
transmission,
memmodel,
flashmethod,
filesize ,
obsolete,
inherit,
ecuDefsFile.getName()
);
}
}

View File

@ -1,119 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition.xml;
import java.util.ArrayList;
import java.util.List;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import com.romraider.logger.ecu.definition.EcuDefinition;
/**
* Get a List of ROM inheritance Nodes from the given DOM and ECU definition.
*/
public class EcuDefinitionInheritanceList {
private EcuDefinitionInheritanceList() {
}
/**
* Get a List of ROM inheritance Nodes
* @param document - the DOM document containing the ECU definition and
* its parents.
* @param ecuDef - ECU definition to start with.
* @return a List of Node starting with the given ECU listing back to the
* base definition.
*/
public static final List<Node> getInheritanceList(
Document document,
EcuDefinition ecuDef) {
final XPathFactory xpf = XPathFactory.newInstance();
final XPath xpath = xpf.newXPath();
final List<String> inheritance = new ArrayList<String>();
inheritance.add(ecuDef.getCalId());
inheritance.add(ecuDef.getInherits());
String base = ecuDef.getInherits();
while (!base.contains("BASE")) {
base = getBaseRomId(xpath, document, base);
inheritance.add(base);
}
final List<Node> inheritanceNodes = new ArrayList<Node>();
for (String inheritId : inheritance) {
Node baseNode = getBaseRomIdNode(xpath, document, inheritId);
inheritanceNodes.add(baseNode);
}
return inheritanceNodes;
}
/**
* Get the CAL ID string of the base inheritance definition.
* @param xpath - the XPath evaluation environment.
* @param document - W3C DOM Document of an ECU definition XML file.
* @param calId - the known CAL ID to find the inheritance for.
* @return the CAL ID from the attribute 'base' in the 'rom' element .
*/
private static final String getBaseRomId(
XPath xpath, Document document, String calId) {
String romBase = null;
try {
final Node calidNode = (Node) xpath.evaluate(
"/roms/rom/romid[xmlid='" + calId + "']",
document, XPathConstants.NODE);
romBase = calidNode.getParentNode().getAttributes().item(0).
getNodeValue();
}
catch (XPathExpressionException e) {
e.printStackTrace();
}
return romBase;
}
/**
* Get the 'rom' Node which contains the CAL ID string.
* @param xpath - the XPath evaluation environment.
* @param document - W3C DOM Document of an ECU definition XM file.
* @param calId - the known CAL ID to find the inheritance for.
* @return the Node of the 'rom' parent element to the CAL ID.
*/
private static final Node getBaseRomIdNode(
XPath xpath, Document document, String calId) {
Node romIdNode = null;
try {
romIdNode = (Node) xpath.evaluate(
"/roms/rom/romid[xmlid='" + calId + "']",
document, XPathConstants.NODE);
romIdNode = romIdNode.getParentNode();
}
catch (XPathExpressionException e) {
e.printStackTrace();
}
return romIdNode;
}
}

View File

@ -1,113 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2013 RomRaider.com
*
* 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 com.romraider.logger.ecu.definition.xml;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
/**
* Parse an ECU Definition XML file and return the attributes of the
* table name supplied.
*/
public final class EcuTableDefinitionHandler {
private EcuTableDefinitionHandler() {
}
/**
* Parse a given ECU Definition XML file and return the attributes of the
* table name supplied.
* @param document - W3C DOM Document of an ECU definition XML file.
* @param inheritanceNodeList - a List of Nodes of the 'rom' parents
* to the CAL ID supplied.
* @param tableName - the name of the table to find.
* @return a Map of table and scaling name/value attributes.
*/
public static final Map<String, String> getTableDefinition(
Document document,
List<Node> inheritanceNodeList,
String tableName) {
final Map<String, String> table =
new HashMap<String, String>();
for (Node inheritIdNode : inheritanceNodeList) {
get2dTableMap(inheritIdNode, tableName, table);
}
return table;
}
/**
* For the given Node and Table Name populate a Map with the table's
* attributes and the scaling attributes.
* @param xpath - the XPath evaluation environment.
* @param node - the 'rom' Node to root the search within.
* @param tableName - the Table Name to locate.
* @param tableMap2d - a Map to populate with attribute names and values.
*/
private static final void get2dTableMap(
Node node, String tableName,
Map<String, String> tableMap2d) {
final XPathFactory xpf = XPathFactory.newInstance();
final XPath xpath = xpf.newXPath();
try {
final Node tableNode = (Node) xpath.evaluate(
"table[@name='" + tableName + "']",
node, XPathConstants.NODE);
addAttributesAsMap(tableNode, tableMap2d);
final Node scalingNode = (Node) xpath.evaluate(
"scaling",
tableNode, XPathConstants.NODE);
addAttributesAsMap(scalingNode, tableMap2d);
}
catch (NullPointerException e) {
}
catch (XPathExpressionException e) {
e.printStackTrace();
}
}
/**
* Convert XML attributes to a Map.
* @param node - the Node containing the attributes.
* @param tableMap - the Map to populate with attribute names and values.
*/
private static final void addAttributesAsMap(
Node node, Map<String, String> tableMap) {
final NamedNodeMap attrs = node.getAttributes();
for (int i = 0; i < attrs.getLength(); i++) {
tableMap.put(
attrs.item(i).getNodeName(),
attrs.item(i).getNodeValue());
}
}
}

View File

@ -1,41 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.exception;
public final class ConfigurationException extends RuntimeException {
private static final long serialVersionUID = 2021993520731842524L;
public ConfigurationException() {
}
public ConfigurationException(String string) {
super(string);
}
public ConfigurationException(String string, Throwable throwable) {
super(string, throwable);
}
public ConfigurationException(Throwable throwable) {
super(throwable);
}
}

View File

@ -1,41 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.exception;
public final class FileLoggerException extends RuntimeException {
private static final long serialVersionUID = -7851192938290131460L;
public FileLoggerException() {
}
public FileLoggerException(String string) {
super(string);
}
public FileLoggerException(String string, Throwable throwable) {
super(string, throwable);
}
public FileLoggerException(Throwable throwable) {
super(throwable);
}
}

View File

@ -1,41 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.exception;
public final class InvalidResponseException extends RuntimeException {
private static final long serialVersionUID = 296093377055913575L;
public InvalidResponseException() {
}
public InvalidResponseException(String string) {
super(string);
}
public InvalidResponseException(String string, Throwable throwable) {
super(string, throwable);
}
public InvalidResponseException(Throwable throwable) {
super(throwable);
}
}

View File

@ -1,39 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.exception;
public final class NotConnectedException extends RuntimeException {
private static final long serialVersionUID = -7287379536144468034L;
public NotConnectedException() {
}
public NotConnectedException(String string) {
super(string);
}
public NotConnectedException(String string, Throwable throwable) {
super(string, throwable);
}
public NotConnectedException(Throwable throwable) {
super(throwable);
}
}

View File

@ -1,40 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.exception;
public final class PortNotFoundException extends RuntimeException {
private static final long serialVersionUID = -523838685805525387L;
public PortNotFoundException() {
}
public PortNotFoundException(String string) {
super(string);
}
public PortNotFoundException(String string, Throwable throwable) {
super(string, throwable);
}
public PortNotFoundException(Throwable throwable) {
super(throwable);
}
}

View File

@ -1,41 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.exception;
public final class SerialCommunicationException extends RuntimeException {
private static final long serialVersionUID = -3468947970939582263L;
public SerialCommunicationException() {
}
public SerialCommunicationException(String msg) {
super(msg);
}
public SerialCommunicationException(String msg, Throwable cause) {
super(msg, cause);
}
public SerialCommunicationException(Throwable cause) {
super(cause);
}
}

View File

@ -1,40 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.exception;
public final class UnsupportedPortTypeException extends RuntimeException {
private static final long serialVersionUID = 5398746954800909391L;
public UnsupportedPortTypeException() {
}
public UnsupportedPortTypeException(String string) {
super(string);
}
public UnsupportedPortTypeException(String string, Throwable throwable) {
super(string, throwable);
}
public UnsupportedPortTypeException(Throwable throwable) {
super(throwable);
}
}

View File

@ -1,41 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.exception;
public final class UnsupportedProtocolException extends RuntimeException {
private static final long serialVersionUID = -5005888534387937344L;
public UnsupportedProtocolException() {
}
public UnsupportedProtocolException(String string) {
super(string);
}
public UnsupportedProtocolException(String string, Throwable throwable) {
super(string, throwable);
}
public UnsupportedProtocolException(Throwable throwable) {
super(throwable);
}
}

View File

@ -1,40 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2014 RomRaider.com
*
* 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 com.romraider.logger.ecu.profile;
import com.romraider.logger.ecu.definition.EcuDataConvertor;
import com.romraider.logger.ecu.definition.LoggerData;
public interface UserProfile {
boolean contains(LoggerData loggerData);
boolean isSelectedOnLiveDataTab(LoggerData loggerData);
boolean isSelectedOnGraphTab(LoggerData loggerData);
boolean isSelectedOnDashTab(LoggerData loggerData);
EcuDataConvertor getSelectedConvertor(LoggerData loggerData);
byte[] getBytes();
String getProtocol();
}

View File

@ -1,38 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.profile;
import com.romraider.swing.GenericFileFilter;
import javax.swing.filechooser.FileFilter;
import java.io.File;
public final class UserProfileFileFilter extends FileFilter {
private final FileFilter filter = new GenericFileFilter("ECU Logger User Profiles", "xml");
public boolean accept(File file) {
return filter.accept(file);
}
public String getDescription() {
return filter.getDescription();
}
}

View File

@ -1,151 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2014 RomRaider.com
*
* 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 com.romraider.logger.ecu.profile;
import com.romraider.Settings;
import com.romraider.logger.ecu.definition.EcuDataConvertor;
import com.romraider.logger.ecu.definition.EcuParameter;
import com.romraider.logger.ecu.definition.EcuSwitch;
import com.romraider.logger.ecu.definition.ExternalData;
import com.romraider.logger.ecu.definition.LoggerData;
import com.romraider.logger.ecu.exception.ConfigurationException;
import com.romraider.util.SettingsManager;
import static com.romraider.util.ParamChecker.checkNotNull;
import static com.romraider.util.ParamChecker.isNullOrEmpty;
import java.util.Map;
public final class UserProfileImpl implements UserProfile {
private static final String NEW_LINE = System.getProperty("line.separator");
private final Map<String, UserProfileItem> params;
private final Map<String, UserProfileItem> switches;
private final Map<String, UserProfileItem> external;
private final String protocol;
public UserProfileImpl(
Map<String, UserProfileItem> params,
Map<String, UserProfileItem> switches,
Map<String, UserProfileItem> external,
String protocol) {
checkNotNull(params, "params");
checkNotNull(switches, "switches");
checkNotNull(external, "external");
this.params = params;
this.switches = switches;
this.external = external;
this.protocol = protocol;
}
public boolean contains(LoggerData loggerData) {
checkNotNull(loggerData, "loggerData");
return getMap(loggerData).keySet().contains(loggerData.getId());
}
public boolean isSelectedOnLiveDataTab(LoggerData loggerData) {
checkNotNull(loggerData, "loggerData");
return contains(loggerData) && getUserProfileItem(loggerData).isLiveDataSelected();
}
public boolean isSelectedOnGraphTab(LoggerData loggerData) {
checkNotNull(loggerData, "loggerData");
return contains(loggerData) && getUserProfileItem(loggerData).isGraphSelected();
}
public boolean isSelectedOnDashTab(LoggerData loggerData) {
checkNotNull(loggerData, "loggerData");
return contains(loggerData) && getUserProfileItem(loggerData).isDashSelected();
}
public EcuDataConvertor getSelectedConvertor(LoggerData loggerData) {
checkNotNull(loggerData, "loggerData");
if (contains(loggerData)) {
String defaultUnits = getUserProfileItem(loggerData).getUnits();
if (defaultUnits != null && loggerData.getConvertors().length > 1) {
for (EcuDataConvertor convertor : loggerData.getConvertors()) {
if (defaultUnits.equals(convertor.getUnits())) return convertor;
}
throw new ConfigurationException("Unknown default units, '" + defaultUnits + "', specified for [" + loggerData.getId() + "] " + loggerData.getName());
}
}
return loggerData.getSelectedConvertor();
}
public byte[] getBytes() {
return buildXml().getBytes();
}
@Override
public String getProtocol() {
return protocol;
}
private String buildXml() {
final Settings settings = SettingsManager.getSettings();
StringBuilder builder = new StringBuilder();
builder.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>").append(NEW_LINE);
builder.append("<!DOCTYPE profile SYSTEM \"profile.dtd\">").append(NEW_LINE).append(NEW_LINE);
builder.append("<profile protocol=\"").append(settings.getLoggerProtocol().toUpperCase()).append("\">").append(NEW_LINE);
if (!params.isEmpty()) {
builder.append(" <parameters>").append(NEW_LINE);
appendLoggerDataElements(builder, "parameter", params, true);
builder.append(" </parameters>").append(NEW_LINE);
}
if (!switches.isEmpty()) {
builder.append(" <switches>").append(NEW_LINE);
appendLoggerDataElements(builder, "switch", switches, false);
builder.append(" </switches>").append(NEW_LINE);
}
if (!external.isEmpty()) {
builder.append(" <externals>").append(NEW_LINE);
// Comment out the next line to disable Externals from being saved
// as there seems to be a bug when a profile is reloaded, the
// Logger tries to connect twice causing one or both to fail.
appendLoggerDataElements(builder, "external", external, true);
builder.append(" </externals>").append(NEW_LINE);
}
builder.append("</profile>").append(NEW_LINE);
return builder.toString();
}
private void appendLoggerDataElements(StringBuilder builder, String dataType, Map<String, UserProfileItem> dataMap, boolean showUnits) {
for (String id : dataMap.keySet()) {
UserProfileItem item = dataMap.get(id);
builder.append(" <").append(dataType).append(" id=\"").append(id).append("\"");
if (item.isLiveDataSelected()) builder.append(" livedata=\"selected\"");
if (item.isGraphSelected()) builder.append(" graph=\"selected\"");
if (item.isDashSelected()) builder.append(" dash=\"selected\"");
if (showUnits && !isNullOrEmpty(item.getUnits()))
builder.append(" units=\"").append(item.getUnits()).append("\"");
builder.append("/>").append(NEW_LINE);
}
}
private UserProfileItem getUserProfileItem(LoggerData loggerData) {
return getMap(loggerData).get(loggerData.getId());
}
private Map<String, UserProfileItem> getMap(LoggerData loggerData) {
if (loggerData instanceof EcuParameter) return params;
else if (loggerData instanceof EcuSwitch) return switches;
else if (loggerData instanceof ExternalData) return external;
else throw new UnsupportedOperationException("Unknown LoggerData type: " + loggerData.getClass());
}
}

View File

@ -1,32 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.profile;
public interface UserProfileItem {
boolean isDashSelected();
boolean isGraphSelected();
boolean isLiveDataSelected();
String getUnits();
}

View File

@ -1,51 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.profile;
public final class UserProfileItemImpl implements UserProfileItem {
private final String units;
private final boolean liveDataSelected;
private final boolean graphSelected;
private final boolean dashSelected;
public UserProfileItemImpl(String units, boolean liveDataSelected, boolean graphSelected, boolean dashSelected) {
this.units = units;
this.liveDataSelected = liveDataSelected;
this.graphSelected = graphSelected;
this.dashSelected = dashSelected;
}
public boolean isDashSelected() {
return dashSelected;
}
public boolean isGraphSelected() {
return graphSelected;
}
public boolean isLiveDataSelected() {
return liveDataSelected;
}
public String getUnits() {
return units;
}
}

View File

@ -1,26 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.profile;
public interface UserProfileLoader {
String BACKUP_PROFILE = "/.RomRaider/profile_backup.xml";
UserProfile loadProfile(String filePath);
}

View File

@ -1,56 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.profile;
import com.romraider.logger.ecu.profile.xml.UserProfileHandler;
import static com.romraider.util.ParamChecker.checkNotNullOrEmpty;
import static com.romraider.util.SaxParserFactory.getSaxParser;
import org.apache.log4j.Logger;
import org.xml.sax.SAXParseException;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
public final class UserProfileLoaderImpl implements UserProfileLoader {
private static final Logger LOGGER = Logger.getLogger(UserProfileLoaderImpl.class);
public UserProfile loadProfile(String userProfileFilePath) {
checkNotNullOrEmpty(userProfileFilePath, "userProfileFilePath");
LOGGER.info("Loading profile: " + userProfileFilePath);
try {
InputStream inputStream = new BufferedInputStream(new FileInputStream(new File(userProfileFilePath)));
try {
UserProfileHandler handler = new UserProfileHandler();
getSaxParser().parse(inputStream, handler);
return handler.getUserProfile();
} finally {
inputStream.close();
}
} catch (SAXParseException spe) {
// catch general parsing exception - enough people don't unzip the defs that a better error message is in order
LOGGER.error("Error loading user profile file: " + userProfileFilePath + ". Please make sure the definition file is correct. If it is in a ZIP archive, unzip the file and try again.");
return null;
} catch (Exception e) {
LOGGER.error("Error loading user profile file: " + userProfileFilePath, e);
return null;
}
}
}

View File

@ -1,79 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2014 RomRaider.com
*
* 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 com.romraider.logger.ecu.profile.xml;
import com.romraider.logger.ecu.profile.UserProfile;
import com.romraider.logger.ecu.profile.UserProfileImpl;
import com.romraider.logger.ecu.profile.UserProfileItem;
import com.romraider.logger.ecu.profile.UserProfileItemImpl;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;
import java.util.HashMap;
import java.util.Map;
public final class UserProfileHandler extends DefaultHandler {
private static final String SELECTED = "selected";
private static final String TAG_PROFILE = "profile";
private static final String TAG_PARAMETER = "parameter";
private static final String TAG_SWITCH = "switch";
private static final String TAG_EXTERNAL = "external";
private static final String ATTR_PROTOCOL = "protocol";
private static final String ATTR_ID = "id";
private static final String ATTR_UNITS = "units";
private static final String ATTR_LIVE_DATA = "livedata";
private static final String ATTR_GRAPH = "graph";
private static final String ATTR_DASH = "dash";
private Map<String, UserProfileItem> params;
private Map<String, UserProfileItem> switches;
private Map<String, UserProfileItem> external;
private String protocol;
public void startDocument() {
params = new HashMap<String, UserProfileItem>();
switches = new HashMap<String, UserProfileItem>();
external = new HashMap<String, UserProfileItem>();
}
public void startElement(String uri, String localName, String qName, Attributes attributes) {
if (TAG_PROFILE.equals(qName)) {
protocol = attributes.getValue(ATTR_PROTOCOL);
} else if (TAG_PARAMETER.equals(qName)) {
params.put(attributes.getValue(ATTR_ID), getUserProfileItem(attributes));
} else if (TAG_SWITCH.equals(qName)) {
switches.put(attributes.getValue(ATTR_ID), getUserProfileItem(attributes));
} else if (TAG_EXTERNAL.equals(qName)) {
external.put(attributes.getValue(ATTR_ID), getUserProfileItem(attributes));
}
}
public UserProfile getUserProfile() {
return new UserProfileImpl(params, switches, external, protocol);
}
private UserProfileItem getUserProfileItem(Attributes attributes) {
return new UserProfileItemImpl(
attributes.getValue(ATTR_UNITS),
SELECTED.equalsIgnoreCase(attributes.getValue(ATTR_LIVE_DATA)),
SELECTED.equalsIgnoreCase(attributes.getValue(ATTR_GRAPH)),
SELECTED.equalsIgnoreCase(attributes.getValue(ATTR_DASH))
);
}
}

View File

@ -1,32 +0,0 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2012 RomRaider.com
*
* 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 com.romraider.logger.ecu.ui;
import com.romraider.logger.ecu.definition.LoggerData;
public interface DataRegistrationBroker extends StatusChangeListener {
void registerLoggerDataForLogging(LoggerData loggerData);
void deregisterLoggerDataFromLogging(LoggerData loggerData);
void clear();
}

Some files were not shown because too many files have changed in this diff Show More