From bb1cded19d54cd7733b6ab29240c79b9c0e1e7b7 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 17 May 2024 15:28:09 -0700 Subject: Support ET01 OBD data --- src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java | 4 ++-- src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java index b10ff4c64..c3ff473bf 100644 --- a/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java @@ -92,7 +92,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder { .number("C(d+);") // coolant temperature .number("L(d+.d);") // fuel level .number("[XY][MH]d+.d+;") - .number("M(d+);") // mileage + .number("M(d+.?d*);") // mileage .number("F(d+.d+);") // fuel consumption .number("T(d+);") // engine time .any() @@ -264,7 +264,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ENGINE_LOAD, parser.nextDouble()); position.set(Position.KEY_COOLANT_TEMP, parser.nextInt()); position.set(Position.KEY_FUEL_LEVEL, parser.nextDouble()); - position.set(Position.KEY_ODOMETER, parser.nextInt()); + position.set(Position.KEY_ODOMETER, parser.nextDouble()); position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble()); position.set(Position.KEY_HOURS, parser.nextInt()); diff --git a/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java index d40463c1e..fee0252b7 100644 --- a/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/EasyTrackProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class EasyTrackProtocolDecoderTest extends ProtocolTest { var decoder = inject(new EasyTrackProtocolDecoder(null)); + verifyAttributes(decoder, text( + "*ET,358162092884226,OB,BD$V13.6;R01510;S023;P034.9;O035.2;C085;L000.0;XM035.170;M4.25;F001.197;T0000730;A09;B00;D00;GX0;GY0;GZ0;")); + verifyAttributes(decoder, text( "*ET,358999999999916,OB,BD$V14.2;R08258;S166;P058.4;O079.2;C025;L081.5;XM091.393;M722379;F352.956;T0037184;A01;B00;D00;GX3;GY-6;GZ-268;@4#")); -- cgit v1.2.3