From 5c808d11d456524dda9fc7e507ed775257e0d0d3 Mon Sep 17 00:00:00 2001 From: kascade Date: Sun, 24 Dec 2006 22:16:19 +0000 Subject: [PATCH] logger autoconnect and ecu init seems to be working... not finished though. git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@394 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d --- src/enginuity/io/protocol/Protocol.java | 5 +- .../io/protocol/SSMChecksumCalculator.java | 39 +++++++ src/enginuity/io/protocol/SSMProtocol.java | 35 ++++-- .../io/protocol/SSMResponseProcessor.java | 103 ++++++++++++++++++ src/enginuity/logger/EcuLogger.java | 10 +- .../controller/LoggerControllerImpl.java | 5 +- .../io/connection/SSMLoggerConnection.java | 13 +-- .../comms/io/protocol/SSMLoggerProtocol.java | 60 +--------- .../comms/manager/QueryManagerImpl.java | 15 ++- src/enginuity/logger/comms/query/EcuInit.java | 30 +++++ .../logger/comms/query/EcuInitCallback.java | 28 +++++ .../logger/comms/query/SSMEcuInit.java | 45 ++++++++ .../exception/ConfigurationException.java | 21 ++++ .../logger/exception/FileLoggerException.java | 21 ++++ .../exception/InvalidResponseException.java | 21 ++++ .../exception/NotConnectedException.java | 21 ++++ .../exception/PortNotFoundException.java | 21 ++++ .../SerialCommunicationException.java | 21 ++++ .../UnsupportedPortTypeException.java | 21 ++++ .../UnsupportedProtocolException.java | 21 ++++ src/enginuity/logger/profile/UserProfile.java | 21 ++++ .../logger/profile/UserProfileFileFilter.java | 21 ++++ .../logger/profile/UserProfileImpl.java | 21 ++++ .../logger/profile/UserProfileItem.java | 21 ++++ .../logger/profile/UserProfileItemImpl.java | 21 ++++ .../logger/profile/UserProfileLoader.java | 21 ++++ .../logger/profile/UserProfileLoaderImpl.java | 21 ++++ .../profile/xml/UserProfileHandler.java | 21 ++++ 28 files changed, 628 insertions(+), 96 deletions(-) create mode 100644 src/enginuity/io/protocol/SSMChecksumCalculator.java create mode 100644 src/enginuity/io/protocol/SSMResponseProcessor.java create mode 100644 src/enginuity/logger/comms/query/EcuInit.java create mode 100644 src/enginuity/logger/comms/query/EcuInitCallback.java create mode 100644 src/enginuity/logger/comms/query/SSMEcuInit.java diff --git a/src/enginuity/io/protocol/Protocol.java b/src/enginuity/io/protocol/Protocol.java index 8631c1ab..3081d7f9 100644 --- a/src/enginuity/io/protocol/Protocol.java +++ b/src/enginuity/io/protocol/Protocol.java @@ -22,6 +22,7 @@ package enginuity.io.protocol; import enginuity.io.connection.ConnectionProperties; +import enginuity.logger.comms.query.EcuInit; public interface Protocol { @@ -31,10 +32,10 @@ public interface Protocol { byte[] constructReadAddressRequest(byte[][] addresses); - byte calculateChecksum(byte[] bytes); - boolean isValidEcuInitResponse(byte[] bytes); + EcuInit parseEcuInitResponse(byte[] response); + ConnectionProperties getConnectionProperties(); } diff --git a/src/enginuity/io/protocol/SSMChecksumCalculator.java b/src/enginuity/io/protocol/SSMChecksumCalculator.java new file mode 100644 index 00000000..e3b5c049 --- /dev/null +++ b/src/enginuity/io/protocol/SSMChecksumCalculator.java @@ -0,0 +1,39 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +package enginuity.io.protocol; + +import static enginuity.util.ByteUtil.asByte; +import static enginuity.util.ByteUtil.asInt; + +public final class SSMChecksumCalculator { + private SSMChecksumCalculator() { + } + + public static byte calculateChecksum(byte[] bytes) { + int total = 0; + for (int i = 0; i < (bytes.length - 1); i++) { + byte b = bytes[i]; + total += asInt(b); + } + return asByte(total - ((total >>> 16) << 16)); + } +} diff --git a/src/enginuity/io/protocol/SSMProtocol.java b/src/enginuity/io/protocol/SSMProtocol.java index 6bac2ffd..107f1c11 100644 --- a/src/enginuity/io/protocol/SSMProtocol.java +++ b/src/enginuity/io/protocol/SSMProtocol.java @@ -22,8 +22,14 @@ package enginuity.io.protocol; import enginuity.io.connection.ConnectionProperties; +import static enginuity.io.protocol.SSMChecksumCalculator.calculateChecksum; +import static enginuity.io.protocol.SSMResponseProcessor.extractResponseData; +import static enginuity.io.protocol.SSMResponseProcessor.filterRequestFromResponse; +import static enginuity.io.protocol.SSMResponseProcessor.validateResponse; +import enginuity.logger.comms.query.EcuInit; +import enginuity.logger.comms.query.SSMEcuInit; +import enginuity.logger.exception.InvalidResponseException; import static enginuity.util.ByteUtil.asByte; -import static enginuity.util.ByteUtil.asInt; import static enginuity.util.ParamChecker.checkGreaterThanZero; import static enginuity.util.ParamChecker.checkNotNullOrEmpty; @@ -61,18 +67,27 @@ public final class SSMProtocol implements Protocol { return buildRequest(READ_ADDRESS_COMMAND, true, addresses); } - public byte calculateChecksum(byte[] bytes) { - int total = 0; - for (int i = 0; i < (bytes.length - 1); i++) { - byte b = bytes[i]; - total += asInt(b); + // TODO: This is not real nice/efficient... + public boolean isValidEcuInitResponse(byte[] response) { + // request responseHeader ecu_id readable_params_switches... checksum + // 8010F001BF40 80F01039FF A210113152 58400673FACB842B83FEA800000060CED4FDB060000F200000000000DC0000551E30C0F222000040FB00E10000000000000000 59 + checkNotNullOrEmpty(response, "response"); + byte[] filteredResponse = filterRequestFromResponse(constructEcuInitRequest(), response); + try { + validateResponse(filteredResponse); + return filteredResponse[4] == ECU_INIT_RESPONSE; + } catch (InvalidResponseException e) { + System.out.println("ECU Init validation error: " + e.getMessage()); + return false; } - return asByte(total - ((total >>> 16) << 16)); } - public boolean isValidEcuInitResponse(byte[] bytes) { - //TODO: Implement this!! - return bytes != null && bytes.length > 0; + public EcuInit parseEcuInitResponse(byte[] response) { + checkNotNullOrEmpty(response, "response"); + byte[] responseData = extractResponseData(filterRequestFromResponse(constructEcuInitRequest(), response)); + byte[] ecuIdBytes = new byte[5]; + System.arraycopy(responseData, 0, ecuIdBytes, 0, 5); + return new SSMEcuInit(ecuIdBytes); } public ConnectionProperties getConnectionProperties() { diff --git a/src/enginuity/io/protocol/SSMResponseProcessor.java b/src/enginuity/io/protocol/SSMResponseProcessor.java new file mode 100644 index 00000000..3f65a677 --- /dev/null +++ b/src/enginuity/io/protocol/SSMResponseProcessor.java @@ -0,0 +1,103 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +package enginuity.io.protocol; + +import static enginuity.io.protocol.SSMChecksumCalculator.calculateChecksum; +import static enginuity.io.protocol.SSMProtocol.DIAGNOSTIC_TOOL_ID; +import static enginuity.io.protocol.SSMProtocol.ECU_ID; +import static enginuity.io.protocol.SSMProtocol.ECU_INIT_RESPONSE; +import static enginuity.io.protocol.SSMProtocol.HEADER; +import static enginuity.io.protocol.SSMProtocol.READ_ADDRESS_RESPONSE; +import static enginuity.io.protocol.SSMProtocol.READ_MEMORY_RESPONSE; +import static enginuity.io.protocol.SSMProtocol.RESPONSE_NON_DATA_BYTES; +import enginuity.logger.exception.InvalidResponseException; +import static enginuity.util.ByteUtil.asByte; +import static enginuity.util.HexUtil.asHex; +import static enginuity.util.ParamChecker.checkNotNull; +import static enginuity.util.ParamChecker.checkNotNullOrEmpty; + +public final class SSMResponseProcessor { + private SSMResponseProcessor() { + } + + public static byte[] filterRequestFromResponse(byte[] request, byte[] response) { + checkNotNull(request, "request"); + checkNotNullOrEmpty(response, "response"); + //System.out.println("Raw request = " + asHex(request)); + //System.out.println("Raw response = " + asHex(response)); + byte[] filteredResponse = new byte[response.length - request.length]; + System.arraycopy(response, request.length, filteredResponse, 0, filteredResponse.length); + //System.out.println("Filtered response = " + asHex(filteredResponse)); + //System.out.println(); + return filteredResponse; + } + + public static void validateResponse(byte[] response) { + int i = 0; + assertTrue(response.length > RESPONSE_NON_DATA_BYTES, "Invalid response length"); + assertEquals(HEADER, response[i++], "Invalid header"); + assertEquals(DIAGNOSTIC_TOOL_ID, response[i++], "Invalid diagnostic tool id"); + assertEquals(ECU_ID, response[i++], "Invalid ECU id"); + assertEquals(asByte(response.length - RESPONSE_NON_DATA_BYTES + 1), response[i++], "Invalid response data length"); + assertOneOf(new byte[]{READ_ADDRESS_RESPONSE, READ_MEMORY_RESPONSE, ECU_INIT_RESPONSE}, response[i], "Invalid response code"); + assertEquals(calculateChecksum(response), response[response.length - 1], "Invalid checksum"); + } + + public static byte[] extractResponseData(byte[] response) { + checkNotNullOrEmpty(response, "response"); + // 0x80 0xF0 0x10 data_length 0xE8 response_data checksum + validateResponse(response); + byte[] data = new byte[response.length - RESPONSE_NON_DATA_BYTES]; + System.arraycopy(response, (RESPONSE_NON_DATA_BYTES - 1), data, 0, data.length); + return data; + } + + + private static void assertTrue(boolean condition, String msg) { + if (!condition) { + throw new InvalidResponseException(msg); + } + } + + + private static void assertEquals(byte expected, byte actual, String msg) { + if (actual != expected) { + throw new InvalidResponseException(msg + ". Expected: " + asHex(new byte[]{expected}) + ". Actual: " + asHex(new byte[]{actual}) + "."); + } + } + + private static void assertOneOf(byte[] validOptions, byte actual, String msg) { + for (byte option : validOptions) { + if (option == actual) { + return; + } + } + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < validOptions.length; i++) { + if (i > 0) { + builder.append(", "); + } + builder.append(asHex(new byte[]{validOptions[i]})); + } + throw new InvalidResponseException(msg + ". Expected one of [" + builder.toString() + "]. Actual: " + asHex(new byte[]{actual}) + "."); + } +} diff --git a/src/enginuity/logger/EcuLogger.java b/src/enginuity/logger/EcuLogger.java index 74d1bcff..90010fef 100644 --- a/src/enginuity/logger/EcuLogger.java +++ b/src/enginuity/logger/EcuLogger.java @@ -25,7 +25,8 @@ import enginuity.Settings; import enginuity.io.port.SerialPortRefresher; import enginuity.logger.comms.controller.LoggerController; import enginuity.logger.comms.controller.LoggerControllerImpl; -import enginuity.logger.comms.query.LoggerCallback; +import enginuity.logger.comms.query.EcuInit; +import enginuity.logger.comms.query.EcuInitCallback; import enginuity.logger.definition.EcuData; import enginuity.logger.definition.EcuDataLoader; import enginuity.logger.definition.EcuDataLoaderImpl; @@ -57,7 +58,6 @@ import enginuity.logger.ui.handler.table.TableUpdateHandler; import enginuity.logger.ui.paramlist.ParameterListTable; import enginuity.logger.ui.paramlist.ParameterListTableModel; import enginuity.logger.ui.paramlist.ParameterRow; -import static enginuity.util.HexUtil.asHex; import static enginuity.util.ParamChecker.checkNotNull; import enginuity.util.ThreadUtil; @@ -144,9 +144,9 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC this.settings = settings; // TODO: Do something useful with this!! - LoggerCallback ecuInitCallback = new LoggerCallback() { - public void callback(byte[] value) { - System.out.println("Ecu Init response = " + asHex(value)); + EcuInitCallback ecuInitCallback = new EcuInitCallback() { + public void callback(EcuInit ecuInit) { + System.out.println("ECU ID = " + ecuInit.getEcuId()); } }; diff --git a/src/enginuity/logger/comms/controller/LoggerControllerImpl.java b/src/enginuity/logger/comms/controller/LoggerControllerImpl.java index 5eec44a8..2202936e 100644 --- a/src/enginuity/logger/comms/controller/LoggerControllerImpl.java +++ b/src/enginuity/logger/comms/controller/LoggerControllerImpl.java @@ -24,6 +24,7 @@ package enginuity.logger.comms.controller; import enginuity.Settings; import enginuity.logger.comms.manager.QueryManager; import enginuity.logger.comms.manager.QueryManagerImpl; +import enginuity.logger.comms.query.EcuInitCallback; import enginuity.logger.comms.query.LoggerCallback; import enginuity.logger.definition.EcuData; import enginuity.logger.ui.ControllerListener; @@ -39,9 +40,9 @@ public final class LoggerControllerImpl implements LoggerController { private final List listeners = synchronizedList(new ArrayList()); private boolean started = false; - public LoggerControllerImpl(Settings settings, LoggerCallback ecuInitCallback, MessageListener messageListener) { + public LoggerControllerImpl(Settings settings, EcuInitCallback ecuInitCallback, MessageListener messageListener) { checkNotNull(settings, ecuInitCallback, messageListener); - queryManager = new QueryManagerImpl(this, settings, ecuInitCallback, messageListener); + queryManager = new QueryManagerImpl(settings, ecuInitCallback, messageListener); } public synchronized void addListener(ControllerListener listener) { diff --git a/src/enginuity/logger/comms/io/connection/SSMLoggerConnection.java b/src/enginuity/logger/comms/io/connection/SSMLoggerConnection.java index 385f3fdd..0dc72638 100644 --- a/src/enginuity/logger/comms/io/connection/SSMLoggerConnection.java +++ b/src/enginuity/logger/comms/io/connection/SSMLoggerConnection.java @@ -23,6 +23,7 @@ package enginuity.logger.comms.io.connection; import enginuity.io.connection.SerialConnection; import enginuity.io.connection.SerialConnectionImpl; +import static enginuity.io.protocol.SSMResponseProcessor.filterRequestFromResponse; import enginuity.logger.comms.io.protocol.LoggerProtocol; import enginuity.logger.comms.io.protocol.SSMLoggerProtocol; import enginuity.logger.comms.query.RegisteredQuery; @@ -46,8 +47,6 @@ public final class SSMLoggerConnection implements LoggerConnection { byte[] request = protocol.constructReadAddressRequest(queries); byte[] response = protocol.constructReadAddressResponse(queries); - //System.out.println("Raw request = " + asHex(request)); - serialConnection.readStaleData(); serialConnection.write(request); int timeout = 1000; @@ -63,15 +62,7 @@ public final class SSMLoggerConnection implements LoggerConnection { } serialConnection.read(response); - //System.out.println("Raw response = " + asHex(response)); - - byte[] filteredResponse = new byte[response.length - request.length]; - System.arraycopy(response, request.length, filteredResponse, 0, filteredResponse.length); - - //System.out.println("Filtered response = " + asHex(filteredResponse)); - //System.out.println(); - - protocol.processReadAddressResponses(queries, filteredResponse); + protocol.processReadAddressResponses(queries, filterRequestFromResponse(request, response)); } catch (Exception e) { close(); throw new SerialCommunicationException(e); diff --git a/src/enginuity/logger/comms/io/protocol/SSMLoggerProtocol.java b/src/enginuity/logger/comms/io/protocol/SSMLoggerProtocol.java index 30c4d4d7..f6157dea 100644 --- a/src/enginuity/logger/comms/io/protocol/SSMLoggerProtocol.java +++ b/src/enginuity/logger/comms/io/protocol/SSMLoggerProtocol.java @@ -26,18 +26,10 @@ import enginuity.io.protocol.Protocol; import enginuity.io.protocol.SSMProtocol; import static enginuity.io.protocol.SSMProtocol.ADDRESS_SIZE; import static enginuity.io.protocol.SSMProtocol.DATA_SIZE; -import static enginuity.io.protocol.SSMProtocol.DIAGNOSTIC_TOOL_ID; -import static enginuity.io.protocol.SSMProtocol.ECU_ID; -import static enginuity.io.protocol.SSMProtocol.ECU_INIT_RESPONSE; -import static enginuity.io.protocol.SSMProtocol.HEADER; -import static enginuity.io.protocol.SSMProtocol.READ_ADDRESS_RESPONSE; -import static enginuity.io.protocol.SSMProtocol.READ_MEMORY_RESPONSE; import static enginuity.io.protocol.SSMProtocol.REQUEST_NON_DATA_BYTES; import static enginuity.io.protocol.SSMProtocol.RESPONSE_NON_DATA_BYTES; +import static enginuity.io.protocol.SSMResponseProcessor.extractResponseData; import enginuity.logger.comms.query.RegisteredQuery; -import enginuity.logger.exception.InvalidResponseException; -import static enginuity.util.ByteUtil.asByte; -import static enginuity.util.HexUtil.asHex; import static enginuity.util.ParamChecker.checkNotNullOrEmpty; import java.util.ArrayList; @@ -46,11 +38,7 @@ import java.util.HashMap; import java.util.Map; public final class SSMLoggerProtocol implements LoggerProtocol { - private final Protocol protocol; - - public SSMLoggerProtocol() { - protocol = new SSMProtocol(); - } + private final Protocol protocol = new SSMProtocol(); public byte[] constructReadAddressRequest(Collection queries) { Collection filteredQueries = filterDuplicates(queries); @@ -94,14 +82,12 @@ public final class SSMLoggerProtocol implements LoggerProtocol { } private Collection filterDuplicates(Collection queries) { -// System.out.println("queries = " + queries); Collection filteredQueries = new ArrayList(); for (RegisteredQuery query : queries) { if (!filteredQueries.contains(query)) { filteredQueries.add(query); } } -// System.out.println("filteredQueries = " + filteredQueries); return filteredQueries; } @@ -121,46 +107,4 @@ public final class SSMLoggerProtocol implements LoggerProtocol { return addresses; } - private byte[] extractResponseData(byte[] response) { - checkNotNullOrEmpty(response, "response"); - // 0x80 0xF0 0x10 data_length 0xE8 response_data checksum - validateResponse(response); - byte[] data = new byte[response.length - RESPONSE_NON_DATA_BYTES]; - System.arraycopy(response, (RESPONSE_NON_DATA_BYTES - 1), data, 0, data.length); - return data; - } - - - private void validateResponse(byte[] response) { - int i = 0; - assertEquals(HEADER, response[i++], "Invalid header"); - assertEquals(DIAGNOSTIC_TOOL_ID, response[i++], "Invalid diagnostic tool id"); - assertEquals(ECU_ID, response[i++], "Invalid ECU id"); - assertEquals(asByte(response.length - RESPONSE_NON_DATA_BYTES + 1), response[i++], "Invalid response data length"); - assertOneOf(new byte[]{READ_ADDRESS_RESPONSE, READ_MEMORY_RESPONSE, ECU_INIT_RESPONSE}, response[i], "Invalid response code"); - assertEquals(protocol.calculateChecksum(response), response[response.length - 1], "Invalid checksum"); - } - - private void assertEquals(byte expected, byte actual, String msg) { - if (actual != expected) { - throw new InvalidResponseException(msg + ". Expected: " + asHex(new byte[]{expected}) + ". Actual: " + asHex(new byte[]{actual}) + "."); - } - } - - private void assertOneOf(byte[] validOptions, byte actual, String msg) { - for (byte option : validOptions) { - if (option == actual) { - return; - } - } - StringBuilder builder = new StringBuilder(); - for (int i = 0; i < validOptions.length; i++) { - if (i > 0) { - builder.append(", "); - } - builder.append(asHex(new byte[]{validOptions[i]})); - } - throw new InvalidResponseException(msg + ". Expected one of [" + builder.toString() + "]. Actual: " + asHex(new byte[]{actual}) + "."); - } - } diff --git a/src/enginuity/logger/comms/manager/QueryManagerImpl.java b/src/enginuity/logger/comms/manager/QueryManagerImpl.java index 7940cc0c..3c0f7a65 100644 --- a/src/enginuity/logger/comms/manager/QueryManagerImpl.java +++ b/src/enginuity/logger/comms/manager/QueryManagerImpl.java @@ -26,12 +26,13 @@ import enginuity.io.connection.EcuConnection; import enginuity.io.connection.EcuConnectionImpl; import enginuity.io.protocol.Protocol; import enginuity.io.protocol.ProtocolFactory; -import enginuity.logger.comms.controller.LoggerController; +import enginuity.logger.comms.query.EcuInitCallback; import enginuity.logger.comms.query.LoggerCallback; import enginuity.logger.comms.query.RegisteredQuery; import enginuity.logger.comms.query.RegisteredQueryImpl; import enginuity.logger.definition.EcuData; import enginuity.logger.ui.MessageListener; +import static enginuity.util.HexUtil.asHex; import static enginuity.util.ParamChecker.checkNotNull; import enginuity.util.ThreadUtil; @@ -47,16 +48,14 @@ public final class QueryManagerImpl implements QueryManager { private final Map queryMap = Collections.synchronizedMap(new HashMap()); private final Map addList = new HashMap(); private final List removeList = new ArrayList(); - private final LoggerController controller; private final Settings settings; - private final LoggerCallback ecuInitCallback; + private final EcuInitCallback ecuInitCallback; private final MessageListener messageListener; private boolean stop = false; private Thread queryManagerThread = null; - public QueryManagerImpl(LoggerController controller, Settings settings, LoggerCallback ecuInitCallback, MessageListener messageListener) { - checkNotNull(controller, settings, ecuInitCallback, messageListener); - this.controller = controller; + public QueryManagerImpl(Settings settings, EcuInitCallback ecuInitCallback, MessageListener messageListener) { + checkNotNull(settings, ecuInitCallback, messageListener); this.settings = settings; this.ecuInitCallback = ecuInitCallback; this.messageListener = messageListener; @@ -92,8 +91,9 @@ public final class QueryManagerImpl implements QueryManager { try { messageListener.reportMessage("Sending ECU Init..."); byte[] response = ecuConnection.send(protocol.constructEcuInitRequest()); + System.out.println("Ecu Init response = " + asHex(response)); if (protocol.isValidEcuInitResponse(response)) { - ecuInitCallback.callback(response); + ecuInitCallback.callback(protocol.parseEcuInitResponse(response)); messageListener.reportMessage("Sending ECU Init...done."); return true; } else { @@ -128,7 +128,6 @@ public final class QueryManagerImpl implements QueryManager { } } catch (Exception e) { e.printStackTrace(); - controller.stop(); messageListener.reportError(e); } finally { txManager.stop(); diff --git a/src/enginuity/logger/comms/query/EcuInit.java b/src/enginuity/logger/comms/query/EcuInit.java new file mode 100644 index 00000000..ce0a842c --- /dev/null +++ b/src/enginuity/logger/comms/query/EcuInit.java @@ -0,0 +1,30 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +package enginuity.logger.comms.query; + +public interface EcuInit { + + String getEcuId(); + + byte[] getEcuIdBytes(); + +} diff --git a/src/enginuity/logger/comms/query/EcuInitCallback.java b/src/enginuity/logger/comms/query/EcuInitCallback.java new file mode 100644 index 00000000..35bf97a5 --- /dev/null +++ b/src/enginuity/logger/comms/query/EcuInitCallback.java @@ -0,0 +1,28 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +package enginuity.logger.comms.query; + +public interface EcuInitCallback { + + void callback(EcuInit ecuInit); + +} diff --git a/src/enginuity/logger/comms/query/SSMEcuInit.java b/src/enginuity/logger/comms/query/SSMEcuInit.java new file mode 100644 index 00000000..4b5eeb8e --- /dev/null +++ b/src/enginuity/logger/comms/query/SSMEcuInit.java @@ -0,0 +1,45 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +package enginuity.logger.comms.query; + +import static enginuity.util.HexUtil.asHex; +import static enginuity.util.ParamChecker.checkNotNullOrEmpty; + +public final class SSMEcuInit implements EcuInit { + private byte[] ecuIdBytes; + private String ecuId; + + public SSMEcuInit(byte[] ecuIdBytes) { + checkNotNullOrEmpty(ecuIdBytes, "ecuIdBytes"); + this.ecuIdBytes = ecuIdBytes; + ecuId = asHex(ecuIdBytes); + } + + public String getEcuId() { + return ecuId; + } + + public byte[] getEcuIdBytes() { + return ecuIdBytes; + } + +} diff --git a/src/enginuity/logger/exception/ConfigurationException.java b/src/enginuity/logger/exception/ConfigurationException.java index 2b318a86..6149c351 100644 --- a/src/enginuity/logger/exception/ConfigurationException.java +++ b/src/enginuity/logger/exception/ConfigurationException.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.exception; public final class ConfigurationException extends RuntimeException { diff --git a/src/enginuity/logger/exception/FileLoggerException.java b/src/enginuity/logger/exception/FileLoggerException.java index 0b6f946e..e07a44ff 100644 --- a/src/enginuity/logger/exception/FileLoggerException.java +++ b/src/enginuity/logger/exception/FileLoggerException.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.exception; public final class FileLoggerException extends RuntimeException { diff --git a/src/enginuity/logger/exception/InvalidResponseException.java b/src/enginuity/logger/exception/InvalidResponseException.java index 70320bcb..fd859c28 100644 --- a/src/enginuity/logger/exception/InvalidResponseException.java +++ b/src/enginuity/logger/exception/InvalidResponseException.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.exception; public final class InvalidResponseException extends RuntimeException { diff --git a/src/enginuity/logger/exception/NotConnectedException.java b/src/enginuity/logger/exception/NotConnectedException.java index a70fd0ee..52a493b8 100644 --- a/src/enginuity/logger/exception/NotConnectedException.java +++ b/src/enginuity/logger/exception/NotConnectedException.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.exception; public final class NotConnectedException extends RuntimeException { diff --git a/src/enginuity/logger/exception/PortNotFoundException.java b/src/enginuity/logger/exception/PortNotFoundException.java index 659e57fb..8da594b8 100644 --- a/src/enginuity/logger/exception/PortNotFoundException.java +++ b/src/enginuity/logger/exception/PortNotFoundException.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.exception; public final class PortNotFoundException extends RuntimeException { diff --git a/src/enginuity/logger/exception/SerialCommunicationException.java b/src/enginuity/logger/exception/SerialCommunicationException.java index dae26386..c087db4b 100644 --- a/src/enginuity/logger/exception/SerialCommunicationException.java +++ b/src/enginuity/logger/exception/SerialCommunicationException.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.exception; public final class SerialCommunicationException extends RuntimeException { diff --git a/src/enginuity/logger/exception/UnsupportedPortTypeException.java b/src/enginuity/logger/exception/UnsupportedPortTypeException.java index 02a5a02e..fa4a0102 100644 --- a/src/enginuity/logger/exception/UnsupportedPortTypeException.java +++ b/src/enginuity/logger/exception/UnsupportedPortTypeException.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.exception; public final class UnsupportedPortTypeException extends RuntimeException { diff --git a/src/enginuity/logger/exception/UnsupportedProtocolException.java b/src/enginuity/logger/exception/UnsupportedProtocolException.java index f62ba65b..d6dd56b0 100644 --- a/src/enginuity/logger/exception/UnsupportedProtocolException.java +++ b/src/enginuity/logger/exception/UnsupportedProtocolException.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.exception; public final class UnsupportedProtocolException extends RuntimeException { diff --git a/src/enginuity/logger/profile/UserProfile.java b/src/enginuity/logger/profile/UserProfile.java index ffc9ffcd..0ca73b1d 100644 --- a/src/enginuity/logger/profile/UserProfile.java +++ b/src/enginuity/logger/profile/UserProfile.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.profile; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/profile/UserProfileFileFilter.java b/src/enginuity/logger/profile/UserProfileFileFilter.java index dfe0ee7c..929d72a0 100644 --- a/src/enginuity/logger/profile/UserProfileFileFilter.java +++ b/src/enginuity/logger/profile/UserProfileFileFilter.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.profile; import enginuity.swing.GenericFileFilter; diff --git a/src/enginuity/logger/profile/UserProfileImpl.java b/src/enginuity/logger/profile/UserProfileImpl.java index 35c7b243..2124d8ba 100644 --- a/src/enginuity/logger/profile/UserProfileImpl.java +++ b/src/enginuity/logger/profile/UserProfileImpl.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.profile; import enginuity.logger.definition.EcuData; diff --git a/src/enginuity/logger/profile/UserProfileItem.java b/src/enginuity/logger/profile/UserProfileItem.java index 50c9a80f..dc168d11 100644 --- a/src/enginuity/logger/profile/UserProfileItem.java +++ b/src/enginuity/logger/profile/UserProfileItem.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.profile; public interface UserProfileItem { diff --git a/src/enginuity/logger/profile/UserProfileItemImpl.java b/src/enginuity/logger/profile/UserProfileItemImpl.java index 21aa4174..004cf3a2 100644 --- a/src/enginuity/logger/profile/UserProfileItemImpl.java +++ b/src/enginuity/logger/profile/UserProfileItemImpl.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.profile; public final class UserProfileItemImpl implements UserProfileItem { diff --git a/src/enginuity/logger/profile/UserProfileLoader.java b/src/enginuity/logger/profile/UserProfileLoader.java index c54ba9cd..209d5407 100644 --- a/src/enginuity/logger/profile/UserProfileLoader.java +++ b/src/enginuity/logger/profile/UserProfileLoader.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.profile; public interface UserProfileLoader { diff --git a/src/enginuity/logger/profile/UserProfileLoaderImpl.java b/src/enginuity/logger/profile/UserProfileLoaderImpl.java index 2047e1f0..62d0fa86 100644 --- a/src/enginuity/logger/profile/UserProfileLoaderImpl.java +++ b/src/enginuity/logger/profile/UserProfileLoaderImpl.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.profile; import enginuity.logger.profile.xml.UserProfileHandler; diff --git a/src/enginuity/logger/profile/xml/UserProfileHandler.java b/src/enginuity/logger/profile/xml/UserProfileHandler.java index f6fb8ed0..0f34d7c9 100644 --- a/src/enginuity/logger/profile/xml/UserProfileHandler.java +++ b/src/enginuity/logger/profile/xml/UserProfileHandler.java @@ -1,3 +1,24 @@ +/* + * + * Enginuity Open-Source Tuning, Logging and Reflashing + * Copyright (C) 2006 Enginuity.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + package enginuity.logger.profile.xml; import enginuity.logger.profile.UserProfile;