aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Gl200ProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/Gl200ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java20
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 {