mirror of https://github.com/rusefi/RomRaider.git
replaced individual <byte> tags im logger.xml with a address length attribute
git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@488 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
parent
fe0a17bf3e
commit
e125b14347
|
@ -1,12 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!ELEMENT byte ( #PCDATA ) >
|
||||
<!ELEMENT address ( #PCDATA ) >
|
||||
<!ATTLIST address length CDATA #IMPLIED >
|
||||
|
||||
<!ELEMENT ecu ( byte+ ) >
|
||||
<!ELEMENT ecu ( address+ ) >
|
||||
<!ATTLIST ecu id CDATA #REQUIRED >
|
||||
|
||||
<!ELEMENT address ( ecu+ | byte+ ) >
|
||||
|
||||
<!ELEMENT ref EMPTY >
|
||||
<!ATTLIST ref ecuparam CDATA #IMPLIED >
|
||||
<!ATTLIST ref parameter IDREF #IMPLIED >
|
||||
|
@ -39,7 +38,7 @@
|
|||
|
||||
<!ELEMENT switches ( switch+ ) >
|
||||
|
||||
<!ELEMENT ecuparam ( address, conversions ) >
|
||||
<!ELEMENT ecuparam ( ecu+, conversions ) >
|
||||
<!ATTLIST ecuparam desc CDATA #REQUIRED >
|
||||
<!ATTLIST ecuparam name CDATA #REQUIRED >
|
||||
<!ATTLIST ecuparam id ID #REQUIRED >
|
||||
|
|
440
logger.xml
440
logger.xml
File diff suppressed because it is too large
Load Diff
|
@ -99,8 +99,6 @@ TODO: add better debug logging, preferably to a file and switchable (on/off)
|
|||
TODO: Clean up this class!
|
||||
So much to do, so little time....
|
||||
|
||||
TODO: add length attribute to <byte> tags in logger.xml
|
||||
TODO: remove duplicate addresses from queries (and resolve response values back to original requests)
|
||||
TODO: Keyboard accessibility (enable/disable parameters, select tabs, etc)
|
||||
TODO: Add ecu id and calid to ecu_defs
|
||||
TODO: parse ecu info from ecu defs (old and new formats) based on ecu id and display in UI
|
||||
|
|
|
@ -33,6 +33,7 @@ import enginuity.logger.definition.EcuParameterImpl;
|
|||
import enginuity.logger.definition.EcuSwitch;
|
||||
import enginuity.logger.definition.EcuSwitchConvertorImpl;
|
||||
import enginuity.logger.definition.EcuSwitchImpl;
|
||||
import enginuity.util.HexUtil;
|
||||
import static enginuity.util.ParamChecker.checkNotNullOrEmpty;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
|
@ -41,6 +42,7 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -53,7 +55,6 @@ public final class LoggerDefinitionHandler extends DefaultHandler {
|
|||
private static final String TAG_DEPENDS = "depends";
|
||||
private static final String TAG_CONVERSION = "conversion";
|
||||
private static final String TAG_CONVERSIONS = "conversions";
|
||||
private static final String TAG_BYTE = "byte";
|
||||
private static final String TAG_REF = "ref";
|
||||
private static final String TAG_SWITCH = "switch";
|
||||
private static final String TAG_ECUPARAM = "ecuparam";
|
||||
|
@ -62,6 +63,7 @@ public final class LoggerDefinitionHandler extends DefaultHandler {
|
|||
private static final String ATTR_NAME = "name";
|
||||
private static final String ATTR_DESC = "desc";
|
||||
private static final String ATTR_ECUBYTEINDEX = "ecubyteindex";
|
||||
private static final String ATTR_LENGTH = "length";
|
||||
private static final String ATTR_ECUBIT = "ecubit";
|
||||
private static final String ATTR_UNITS = "units";
|
||||
private static final String ATTR_EXPRESSION = "expr";
|
||||
|
@ -88,6 +90,7 @@ public final class LoggerDefinitionHandler extends DefaultHandler {
|
|||
private Map<String, String[]> ecuAddressMap;
|
||||
private boolean derived;
|
||||
private int bit;
|
||||
private int addressLength;
|
||||
private Set<EcuDataConvertor> convertorList;
|
||||
private Set<EcuDerivedParameterConvertor> derivedConvertorList;
|
||||
private StringBuilder charBuffer;
|
||||
|
@ -118,8 +121,9 @@ public final class LoggerDefinitionHandler extends DefaultHandler {
|
|||
ecuByteIndex = attributes.getValue(ATTR_ECUBYTEINDEX);
|
||||
ecuBit = attributes.getValue(ATTR_ECUBIT);
|
||||
} else if (TAG_ADDRESS.equals(qName)) {
|
||||
addressList = new LinkedHashSet<String>();
|
||||
ecuAddressMap = new HashMap<String, String[]>();
|
||||
String length = attributes.getValue(ATTR_LENGTH);
|
||||
addressLength = length == null ? 1 : Integer.valueOf(length);
|
||||
addressList = new LinkedHashSet<String>(addressLength);
|
||||
derived = false;
|
||||
} else if (TAG_DEPENDS.equals(qName)) {
|
||||
dependsList = new LinkedHashSet<String>();
|
||||
|
@ -145,13 +149,15 @@ public final class LoggerDefinitionHandler extends DefaultHandler {
|
|||
addressList = new HashSet<String>();
|
||||
addressList.add(attributes.getValue(ATTR_BYTE));
|
||||
bit = Integer.valueOf(attributes.getValue(ATTR_BIT));
|
||||
derived = false;
|
||||
} else if (TAG_ECUPARAM.equals(qName)) {
|
||||
id = attributes.getValue(ATTR_ID);
|
||||
name = attributes.getValue(ATTR_NAME);
|
||||
desc = attributes.getValue(ATTR_DESC);
|
||||
ecuAddressMap = new HashMap<String, String[]>();
|
||||
derived = false;
|
||||
} else if (TAG_ECU.equals(qName)) {
|
||||
ecuIds = attributes.getValue(ATTR_ID);
|
||||
addressList = new LinkedHashSet<String>();
|
||||
}
|
||||
}
|
||||
charBuffer = new StringBuilder();
|
||||
|
@ -167,8 +173,9 @@ public final class LoggerDefinitionHandler extends DefaultHandler {
|
|||
if (TAG_PROTOCOL.equals(qName)) {
|
||||
parseProtocol = false;
|
||||
} else if (parseProtocol) {
|
||||
if (TAG_BYTE.equals(qName)) {
|
||||
addressList.add(charBuffer.toString());
|
||||
if (TAG_ADDRESS.equals(qName)) {
|
||||
String startAddress = charBuffer.toString();
|
||||
addressList.addAll(getAddressList(startAddress, addressLength));
|
||||
} else if (TAG_PARAMETER.equals(qName)) {
|
||||
if (derived) {
|
||||
Set<EcuData> dependencies = new HashSet<EcuData>();
|
||||
|
@ -219,6 +226,31 @@ public final class LoggerDefinitionHandler extends DefaultHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private List<String> getAddressList(String startAddress, int addressLength) {
|
||||
List<String> addresses = new LinkedList<String>();
|
||||
int start = HexUtil.hexToInt(startAddress);
|
||||
for (int i = 0; i < addressLength; i++) {
|
||||
addresses.add(padAddress(HexUtil.intToHexString(start + i), startAddress.length()));
|
||||
}
|
||||
// System.out.println(startAddress + ":" + addressLength + " => " + addresses);
|
||||
return addresses;
|
||||
}
|
||||
|
||||
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 boolean isSupportedParameter(final EcuInit ecuInit, final String ecuByteIndex, final String ecuBit) {
|
||||
byte[] bytes = new byte[1];
|
||||
System.arraycopy(ecuInit.getEcuInitBytes(), Integer.parseInt(ecuByteIndex), bytes, 0, 1);
|
||||
|
|
Loading…
Reference in New Issue