From 76f85aee7141d1e7e75f59c46d7325fe35d08c19 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 9 Nov 2018 20:35:34 +1300 Subject: Improve GV500 GTFRI decoding --- src/org/traccar/protocol/Gl200TextProtocolDecoder.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java index 45b80f0a6..0d600e240 100644 --- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -190,9 +190,6 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { .expression(PATTERN_LOCATION.pattern()) .expression(")+)") .groupBegin() - .number("(d{1,7}.d)?,").optional() // odometer - .number("(d{1,3})?,") // battery - .or() .number("(d{1,7}.d)?,") // odometer .number("(d{5}:dd:dd)?,") // hour meter .number("(x+)?,") // adc 1 @@ -202,6 +199,9 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { .number("(d+)?,") // rpm .number("(?:d+.?d*|Inf|NaN)?,") // fuel consumption .number("(d+)?,") // fuel level + .or() + .number("(d{1,7}.d)?,").optional() // odometer + .number("(d{1,3})?,") // battery .groupEnd() .any() .number("(dddd)(dd)(dd)") // date (yyyymmdd) @@ -740,11 +740,6 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY_LEVEL, battery); } - if (parser.hasNext()) { - position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000); - } - position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt()); - if (parser.hasNext()) { position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000); } @@ -758,6 +753,11 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_RPM, parser.nextInt()); position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); + if (parser.hasNext()) { + position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000); + } + position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt()); + decodeDeviceTime(position, parser); if (ignoreFixTime) { positions.clear(); -- cgit v1.2.3