aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java31
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java6
2 files changed, 35 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 3628730e3..38b1df1a6 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -44,7 +44,30 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
"(?:\\x00?\\x04,\\p{XDigit}{4},[01],))" +
"GT...," +
"(?:[0-9A-Z]{2}\\p{XDigit}{4})?," + // Protocol version
- "([^,]+),.*," + // IMEI
+ "([^,]+)," + // IMEI
+
+ "(?:[0-9A-Z]{17}," + // VIN
+ "[^,]{0,20}," + // Device name
+ "[01]," + // Report type
+ "\\p{XDigit}{1,8}," + // Report mask
+ "[0-9A-Z]{17}," + // VIN
+ "[01]," + // ODB connect
+ "\\d{1,5}," + // ODB voltage
+ "\\p{XDigit}{8}," + // Support PIDs
+ "\\d{1,5}," + // Engine RPM
+ "\\d{1,3}," + // Speed
+ "-?\\d{1,3}," + // Coolant temp
+ "(\\d+\\.?\\d*|Inf|NaN)?," + // Fuel consumption
+ "\\d{1,5}," + // Odometer
+ "\\d{1,5}," +
+ "[01]," + // ODB connect
+ "\\d{1,3}," + // Number of DTCs
+ "\\p{XDigit}*," + // DTCs
+ "\\d{1,3}," + // Throttle
+ "\\d{1,3}," + // Engine load
+ "(\\d{1,3})?,"+ // Fuel level
+ "\\d+|.*)," + // Odometer
+
"(\\d*)," + // GPS accuracy
"(\\d+.\\d)?," + // Speed
"(\\d+)?," + // Course
@@ -58,7 +81,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
"(\\p{XDigit}{4}|\\p{XDigit}{8})?," + // LAC
"(\\p{XDigit}{4})?," + // Cell
"(?:(\\d+\\.\\d)?," + // Odometer
- "(\\d{1,3})?,)?" + // Battery
+ "(\\d{1,3})?,)?" + // Battery*/
".*," +
"(\\p{XDigit}{4})\\$?");
@@ -96,6 +119,10 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
+ // Fuel
+ position.set("fuel-consumption", parser.group(index++));
+ position.set(Event.KEY_FUEL, parser.group(index++));
+
// Validity
position.setValid(Integer.valueOf(parser.group(index++)) < 20);
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index 6eeb9c13b..1a816554f 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -12,6 +12,12 @@ public class Gl200ProtocolDecoderTest extends ProtocolDecoderTest {
Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new Gl200Protocol());
verify(decoder.decode(null, null,
+ "+RESP:GTOBD,1F0109,864251020135483,,gv500,0,78FFFF,,1,12613,,,,,,,,,,,,,,1286,0,0.0,0,17.1,3.379630,6.529701,20150813074639,0621,0030,51C0,A2B3,00,0.0,20150813074641,A7E6$"));
+
+ verify(decoder.decode(null, null,
+ "+RESP:GTOBD,1F0109,864251020135483,4T1BE46KX7U018210,gv500,0,78FFFF,4T1BE46KX7U018210,1,13411,981B81C0,787,3,43,,921,463,1,10,0300030103030304001200310351035203530354,20,55,,1286,0,6.5,74,21.6,3.379710,6.529714,20150813074824,0621,0030,51C0,A2B3,00,0.0,20150813074828,A7E9$"));
+
+ verify(decoder.decode(null, null,
"+RESP:GTSTT,1A0401,860599000508846,,41,0,0.0,84,107.5,-76.657998,39.497203,20150623160622,0310,0260,B435,3B81,,20150623160622,0F54$"));
verify(decoder.decode(null, null,