diff --git a/reader/src/main/java/com/rusefi/can/analysis/ByteRateOfChangeReports.java b/reader/src/main/java/com/rusefi/can/analysis/ByteRateOfChangeReports.java index da63711..eb50f3b 100644 --- a/reader/src/main/java/com/rusefi/can/analysis/ByteRateOfChangeReports.java +++ b/reader/src/main/java/com/rusefi/can/analysis/ByteRateOfChangeReports.java @@ -121,7 +121,7 @@ public class ByteRateOfChangeReports { PerSidDump.handle(dbc, reportDestinationFolder, simpleFileName, logFileContent); // at the moment we overwrite counter detection report after we process each file - CounterScanner.scanForCounters(reportDestinationFolder, simpleFileName, logFileContent); + CounterScanner.scanForCounters(dbc, reportDestinationFolder, simpleFileName, logFileContent); ChecksumScanner.scanForChecksums(reportDestinationFolder, simpleFileName, logFileContent); CanToMegaLogViewer.createMegaLogViewer(reportDestinationFolder, logFileContent, simpleFileName); diff --git a/reader/src/main/java/com/rusefi/can/analysis/CounterScanner.java b/reader/src/main/java/com/rusefi/can/analysis/CounterScanner.java index 17c467c..de02f90 100644 --- a/reader/src/main/java/com/rusefi/can/analysis/CounterScanner.java +++ b/reader/src/main/java/com/rusefi/can/analysis/CounterScanner.java @@ -1,6 +1,8 @@ package com.rusefi.can.analysis; import com.rusefi.can.CANPacket; +import com.rusefi.can.reader.dbc.DbcFile; +import com.rusefi.can.reader.dbc.DbcPacket; import org.yaml.snakeyaml.Yaml; import java.io.*; @@ -10,7 +12,7 @@ public class CounterScanner { public static final String COUNTERS_YAML = "counters.yaml"; - public static void scanForCounters(String reportDestinationFolder, String simpleFileName, List packets) throws IOException { + public static void scanForCounters(DbcFile dbc, String reportDestinationFolder, String simpleFileName, List packets) throws IOException { String outputFileName = reportDestinationFolder + File.separator + simpleFileName + "_counter_report.txt"; PrintWriter pw = new PrintWriter(new FileOutputStream(outputFileName)); @@ -52,7 +54,8 @@ public class CounterScanner { List countersWithWidth = CounterAggregator.scan(counters); Yaml yaml = new Yaml(); - Map> map = new TreeMap<>(); + + Map> map = new TreeMap<>(); pw.println("Here are the founding:"); for (CounterAggregator.CounterWithWidth counterWithWidth : countersWithWidth) { @@ -64,7 +67,16 @@ public class CounterScanner { } String yamlCountersReportFileName = reportDestinationFolder + File.separator + COUNTERS_YAML; System.out.println(new Date() + " Writing report to " + yamlCountersReportFileName); - yaml.dump(map, new FileWriter(yamlCountersReportFileName)); + + + Map> report = new TreeMap<>(); + for (Map.Entry> e : map.entrySet()) { + Integer sid = e.getKey(); + DbcPacket packet = dbc == null ? null : dbc.packets.get(sid); + String key = packet == null ? Integer.toString(sid) : packet.getName(); + report.put(key, e.getValue()); + } + yaml.dump(report, new FileWriter(yamlCountersReportFileName)); pw.close(); } @@ -177,4 +189,8 @@ public class CounterScanner { throw new IllegalStateException(state.toString()); } } + + static class Id { + + } }