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.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 59f013313..4103ebba6 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
@@ -386,8 +387,8 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(deviceSession.getDeviceId());
position.set("deviceType", parser.next());
- position.set("firmwareVersion", parser.nextInt(16));
- position.set("hardwareVersion", parser.nextInt(16));
+ position.set(Position.KEY_VERSION_FW, parser.nextInt(16));
+ position.set(Position.KEY_VERSION_HW, parser.nextInt(16));
DateBuilder dateBuilder = new DateBuilder()
.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
@@ -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 {