mirror of https://github.com/rusefi/RomRaider.git
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
This commit is contained in:
parent
7291f0d5d4
commit
5c808d11d4
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -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() {
|
||||
|
|
|
@ -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}) + ".");
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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<ControllerListener> listeners = synchronizedList(new ArrayList<ControllerListener>());
|
||||
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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<RegisteredQuery> queries) {
|
||||
Collection<RegisteredQuery> filteredQueries = filterDuplicates(queries);
|
||||
|
@ -94,14 +82,12 @@ public final class SSMLoggerProtocol implements LoggerProtocol {
|
|||
}
|
||||
|
||||
private Collection<RegisteredQuery> filterDuplicates(Collection<RegisteredQuery> queries) {
|
||||
// System.out.println("queries = " + queries);
|
||||
Collection<RegisteredQuery> filteredQueries = new ArrayList<RegisteredQuery>();
|
||||
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}) + ".");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<String, RegisteredQuery> queryMap = Collections.synchronizedMap(new HashMap<String, RegisteredQuery>());
|
||||
private final Map<String, RegisteredQuery> addList = new HashMap<String, RegisteredQuery>();
|
||||
private final List<String> removeList = new ArrayList<String>();
|
||||
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();
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue