progress :)
This commit is contained in:
parent
30fb762a80
commit
ebd36aaa54
|
@ -10,7 +10,10 @@ import static com.rusefi.can.reader.CANLineReader.getReader;
|
|||
|
||||
public class TrcToMlq {
|
||||
public static ReaderType getCurrentReaderType() {
|
||||
return ReaderType.PCAN;
|
||||
String property = System.getProperty("TRACE_READER", "PCAN");
|
||||
ReaderType readerType = ReaderType.valueOf(property);
|
||||
System.out.println("getCurrentReaderType: " + readerType + " for [" + property + "]");
|
||||
return readerType;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
|
|
@ -23,6 +23,8 @@ public class DbcField {
|
|||
public static DbcField parseField(DbcPacket parent, String line) {
|
||||
line = DbcFile.replaceSpecialWithSpaces(line);
|
||||
String[] tokens = line.split(" ");
|
||||
if (tokens.length < 2)
|
||||
return null;
|
||||
String name = tokens[1];
|
||||
int index = 1;
|
||||
while (!tokens[index - 1].equals(":"))
|
||||
|
|
|
@ -44,9 +44,17 @@ public class DbcFile {
|
|||
purgePacket(currentPacket);
|
||||
line = line.replaceAll(":", "");
|
||||
String[] tokens = line.split(" ");
|
||||
int decId = Integer.parseInt(tokens[1]);
|
||||
if (tokens.length < 3) {
|
||||
// skipping header line
|
||||
continue;
|
||||
}
|
||||
long decId = Long.parseLong(tokens[1]);
|
||||
if (decId > 2_000_000_000) {
|
||||
System.err.println("Huh? Skipping ID=" + decId);
|
||||
continue;
|
||||
}
|
||||
String packetName = tokens[2];
|
||||
currentPacket = new DbcPacket(decId, packetName);
|
||||
currentPacket = new DbcPacket((int) decId, packetName);
|
||||
} else if (line.startsWith("CM_")) {
|
||||
purgePacket(currentPacket);
|
||||
line = replaceSpecialWithSpaces(line);
|
||||
|
@ -69,7 +77,8 @@ public class DbcFile {
|
|||
DbcField field = DbcField.parseField(currentPacket, line);
|
||||
if (debugEnabled)
|
||||
System.out.println("Found " + field);
|
||||
currentPacket.add(field);
|
||||
if (field != null)
|
||||
currentPacket.add(field);
|
||||
|
||||
} else {
|
||||
// skipping useless line
|
||||
|
|
|
@ -4,12 +4,7 @@ import com.rusefi.can.CANPacket;
|
|||
import com.rusefi.can.reader.CANLineReader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum CANoeReader implements CANLineReader {
|
||||
INSTANCE;
|
||||
|
|
|
@ -11,7 +11,6 @@ public enum CanHackerReader implements CANLineReader {
|
|||
line = line.trim();
|
||||
if (line.startsWith("@"))
|
||||
return null;
|
||||
System.out.println("readLine " + line);
|
||||
|
||||
String[] tokens = line.split("\\s+");
|
||||
double timeStamp = Double.parseDouble(CANLineReader.attemptToFixLocalization(tokens[0]));
|
||||
|
|
Loading…
Reference in New Issue