diff options
author | jon-stumpf <jon.stumpf@gmail.com> | 2017-02-20 10:54:34 -0500 |
---|---|---|
committer | jon-stumpf <jon.stumpf@gmail.com> | 2017-02-20 10:54:34 -0500 |
commit | 888c392af40187f3a0ecc3395495db9acd85b827 (patch) | |
tree | beb74dff8b8052ffb4a7d3c894b2b4e5a4434973 /src/org/traccar/protocol/Gl200ProtocolDecoder.java | |
parent | 38249673287b908c0ca55847a35ca16a7b6a0c50 (diff) | |
parent | 2449895139fa658d082c1085185003a001225bc3 (diff) | |
download | trackermap-server-888c392af40187f3a0ecc3395495db9acd85b827.tar.gz trackermap-server-888c392af40187f3a0ecc3395495db9acd85b827.tar.bz2 trackermap-server-888c392af40187f3a0ecc3395495db9acd85b827.zip |
Resolved conflict with master;
Diffstat (limited to 'src/org/traccar/protocol/Gl200ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gl200ProtocolDecoder.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 59f013313..ef434b779 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -107,7 +107,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { .compile(); private static final Pattern PATTERN_LOCATION = new PatternBuilder() - .number("(?:d{1,2})?,") // gps accuracy + .number("(d{1,2})?,") // hdop .number("(d{1,3}.d)?,") // speed .number("(d{1,3})?,") // course .number("(-?d{1,5}.d)?,") // altitude @@ -275,6 +275,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { .number("(?:[0-9A-Z]{2}xxxx)?,") // protocol version .number("(d{15}|x{14}),") // imei .any() + .number("(d{1,2})?,") // hdop .number("(d{1,3}.d)?,") // speed .number("(d{1,3})?,") // course .number("(-?d{1,5}.d)?,") // altitude @@ -399,6 +400,10 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { } private void decodeLocation(Position position, Parser parser) { + int hdop = parser.nextInt(); + position.setValid(hdop > 0); + position.set(Position.KEY_HDOP, hdop); + position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); position.setCourse(parser.nextDouble()); position.setAltitude(parser.nextDouble()); @@ -451,11 +456,11 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { position.set("dtcsCodes", parser.next()); position.set(Position.KEY_THROTTLE, parser.next()); position.set(Position.KEY_FUEL, parser.next()); - position.set(Position.KEY_OBD_ODOMETER, parser.next()); + position.set(Position.KEY_OBD_ODOMETER, parser.nextInt() * 1000); decodeLocation(position, parser); - position.set(Position.KEY_ODOMETER, parser.next()); + position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000); if (parser.hasNext(6)) { DateBuilder dateBuilder = new DateBuilder() @@ -510,7 +515,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000); position.set(Position.KEY_BATTERY, parser.next()); - position.set(Position.KEY_ODOMETER, parser.next()); + position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000); position.set(Position.KEY_HOURS, parser.next()); position.set(Position.PREFIX_ADC + 1, parser.next()); position.set(Position.PREFIX_ADC + 2, parser.next()); @@ -666,7 +671,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { decodeLocation(position, parser); - position.set(Position.KEY_ODOMETER, parser.next()); + position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000); position.set(Position.KEY_BATTERY, parser.next()); position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000); @@ -703,12 +708,15 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); + int hdop = parser.nextInt(); + position.setValid(hdop > 0); + position.set(Position.KEY_HDOP, hdop); + position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); position.setCourse(parser.nextDouble()); position.setAltitude(parser.nextDouble()); if (parser.hasNext(2)) { - position.setValid(true); position.setLongitude(parser.nextDouble()); position.setLatitude(parser.nextDouble()); } else { |