diff options
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/helper/ObdDecoder.java | 4 | ||||
-rw-r--r-- | src/org/traccar/model/Position.java | 1 | ||||
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 6 |
3 files changed, 5 insertions, 6 deletions
diff --git a/src/org/traccar/helper/ObdDecoder.java b/src/org/traccar/helper/ObdDecoder.java index 3196c25e4..5a75fa368 100644 --- a/src/org/traccar/helper/ObdDecoder.java +++ b/src/org/traccar/helper/ObdDecoder.java @@ -60,7 +60,7 @@ public final class ObdDecoder { StringBuilder codes = new StringBuilder(); for (int i = 0; i < value.length() / 4; i++) { int numValue = Integer.parseInt(value.substring(i * 4, (i + 1) * 4), 16); - codes.append(','); + codes.append(' '); switch (numValue >> 14) { case 1: codes.append('C'); @@ -78,7 +78,7 @@ public final class ObdDecoder { codes.append(String.format("%04X", numValue & 0x3FFF)); } if (codes.length() > 0) { - return createEntry("dtcs", codes.toString().replaceFirst(",", "")); + return createEntry(Position.KEY_DTCS, codes.toString().trim()); } else { return null; } diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index a1423993b..3a7070083 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -60,6 +60,7 @@ public class Position extends Message { public static final String KEY_ARMED = "armed"; public static final String KEY_ACCURACY = "accuracy"; + public static final String KEY_DTCS = "dtcs"; public static final String KEY_OBD_SPEED = "obdSpeed"; public static final String KEY_OBD_ODOMETER = "obdOdometer"; diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 363834f89..ed50c33f0 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -95,10 +95,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { .number("(d+.?d*%),") // throttle .number("(d+),") // rpm .number("(d+.d+),") // battery - .number("[^,]*,") // dtc 1 - .number("[^,]*,") // dtc 2 - .number("[^,]*,") // dtc 3 - .number("[^,]*") // dtc 4 + .number("([^;]*)") // dtcs .any() .compile(); @@ -197,6 +194,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_THROTTLE, parser.next()); position.set(Position.KEY_RPM, parser.next()); position.set(Position.KEY_BATTERY, parser.next()); + position.set(Position.KEY_DTCS, parser.next().replace(',', ' ').trim()); return position; |