diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-02-24 22:48:41 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-02-24 22:48:41 +1300 |
commit | b395bb276c73a9278ed2dad1168b8c0e8309e7c2 (patch) | |
tree | 3d8b82e8661e6b6836c29e1614d91f529106d1f8 /src/org | |
parent | 2bcaeff435d1e1fa10ab253241e3d722ad29b153 (diff) | |
download | traccar-server-b395bb276c73a9278ed2dad1168b8c0e8309e7c2.tar.gz traccar-server-b395bb276c73a9278ed2dad1168b8c0e8309e7c2.tar.bz2 traccar-server-b395bb276c73a9278ed2dad1168b8c0e8309e7c2.zip |
Workaround for wrong location time
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/protocol/Gl200ProtocolDecoder.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 91e8d86bc..6902e61dd 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -338,6 +338,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { decodeLocation(position, parser); + // power value only on some devices if (power > 10) { position.set(Event.KEY_POWER, power); } @@ -352,6 +353,16 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_BATTERY, parser.next()); position.set(Event.KEY_STATUS, parser.next()); + // workaround for wrong location time + if (parser.hasNext(6)) { + DateBuilder dateBuilder = new DateBuilder() + .setDate(parser.nextInt(), parser.nextInt(), parser.nextInt()) + .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); + if (!position.getOutdated() && position.getFixTime().after(dateBuilder.getDate())) { + position.setTime(dateBuilder.getDate()); + } + } + return positions; } @@ -376,6 +387,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_ODOMETER, parser.next()); + // workaround for wrong location time if (parser.hasNext(6)) { DateBuilder dateBuilder = new DateBuilder() .setDate(parser.nextInt(), parser.nextInt(), parser.nextInt()) |