diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-11-09 20:35:34 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-11-09 20:35:34 +1300 |
commit | 76f85aee7141d1e7e75f59c46d7325fe35d08c19 (patch) | |
tree | e7dc95486ed09c0a302950152fab9b1f378d190a /src | |
parent | 806584d5d19f224eb26cade7096926af9cc0e4c2 (diff) | |
download | trackermap-server-76f85aee7141d1e7e75f59c46d7325fe35d08c19.tar.gz trackermap-server-76f85aee7141d1e7e75f59c46d7325fe35d08c19.tar.bz2 trackermap-server-76f85aee7141d1e7e75f59c46d7325fe35d08c19.zip |
Improve GV500 GTFRI decoding
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/Gl200TextProtocolDecoder.java | 16 |
1 files changed, 8 insertions, 8 deletions
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) @@ -743,11 +743,6 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { 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); - } position.set(Position.KEY_HOURS, parseHours(parser.next())); position.set(Position.PREFIX_ADC + 1, parser.next()); position.set(Position.PREFIX_ADC + 2, parser.next()); @@ -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(); |