aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java18
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java15
2 files changed, 24 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index a0efc47fa..5785c08b7 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -41,7 +41,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
.text("+ACK:GT")
.expression("...,") // type
.number("([0-9A-Z]{2}xxxx),") // protocol version
- .number("(d{15}),") // imei
+ .number("(d{15}|x{14}),") // imei
.any().text(",")
.number("(dddd)(dd)(dd)") // date
.number("(dd)(dd)(dd),") // time
@@ -52,16 +52,16 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_INF = new PatternBuilder()
.text("+").expression("(?:RESP|BUFF):GTINF,")
.number("[0-9A-Z]{2}xxxx,") // protocol version
- .number("(d{15}),") // imei
+ .number("(d{15}|x{14}),") // imei
.expression("(?:[0-9A-Z]{17},)?") // vin
.expression("(?:[^,]+)?,") // device name
.number("(xx),") // state
- .expression("[0-9F]{20},") // iccid
+ .expression("(?:[0-9F]{20})?,") // iccid
.number("d{1,2},")
.number("d{1,2},")
.expression("[01],") // external power
.number("([d.]+)?,") // odometer or external power
- .number("[01]?,") // backup battery
+ .number("d*,") // backup battery or lightness
.number("(d+.d+),") // battery
.expression("([01]),") // charging
.number("(?:d),") // led
@@ -71,7 +71,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
.number("d{14},") // last fix time
.groupBegin()
.number("(d+),") // battery percentage
- .expression("(?:[01]),") // flash type
+ .expression("[01]?,") // flash type
.number("(-?[d.]+)?,,,") // temperature
.or()
.expression("(?:[01])?,").optional() // pin15 mode
@@ -91,7 +91,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_VER = new PatternBuilder()
.text("+").expression("(?:RESP|BUFF):GTVER,")
.number("[0-9A-Z]{2}xxxx,") // protocol version
- .number("(d{15}),") // imei
+ .number("(d{15}|x{14}),") // imei
.expression("[^,]*,") // device name
.expression("([^,]*),") // device type
.number("(xxxx),") // firmware version
@@ -129,7 +129,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_OBD = new PatternBuilder()
.text("+RESP:GTOBD,")
.number("[0-9A-Z]{2}xxxx,") // protocol version
- .number("(d{15}),") // imei
+ .number("(d{15}|x{14}),") // imei
.expression("(?:[0-9A-Z]{17})?,") // vin
.expression("[^,]{0,20},") // device name
.expression("[01],") // report type
@@ -197,7 +197,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_IGN = new PatternBuilder()
.text("+").expression("(?:RESP|BUFF):GTIG[NF],")
.number("(?:[0-9A-Z]{2}xxxx)?,") // protocol version
- .number("(d{15}),") // imei
+ .number("(d{15}|x{14}),") // imei
.expression("[^,]*,") // device name
.number("d+,") // ignition off duration
.expression(PATTERN_LOCATION.pattern())
@@ -213,7 +213,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_IDA = new PatternBuilder()
.text("+RESP:GTIDA,")
.number("(?:[0-9A-Z]{2}xxxx)?,") // protocol version
- .number("(d{15}),") // imei
+ .number("(d{15}|x{14}),") // imei
.expression("[^,]*,,") // device name
.number("([^,]+),") // rfid
.expression("[01],") // report type
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index d3c82fb3a..fa8373898 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -11,6 +11,21 @@ public class Gl200ProtocolDecoderTest extends ProtocolTest {
Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new Gl200Protocol());
verifyAttributes(decoder, text(
+ "+RESP:GTINF,210102,A10000499AEF9B,,41,,0,0,0,15.0,9,3.87,0,1,1,0,0,20161101140211,72,,,,,20161101140211,00A3$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTNMR,210102,A10000499AEF9B,,0,0,1,9,0.0,0,288.0,-76.902364,39.578828,20161101134145,,,,,00,73,20161101134145,009F$"));
+
+ verifyPositions(decoder, text(
+ "+RESP:GTFRI,210102,A10000499AEF9B,,0,1,1,9,0.5,0,288.0,-76.902364,39.578828,20161101134124,,,,,00,73,20161101134123,009D$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTRTL,210102,A10000499AEF9B,,0,0,1,10,0.2,0,305.4,-76.902274,39.578517,20161101155001,,,,,00,73,20161101155001,00A6$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTINF,110100,358688000000158,,41,898600810906F8048812,18,99,0,33.23,1,4.19,1,1,1,0,0,20110714104934,100,,,,,20110714104934,0014$"));
+
+ verifyAttributes(decoder, text(
"+RESP:GTINF,080100,135790246811220,,16,898600810906F8048812,16,0,1,11870,,4.1,0,0,0,,20090214013254,,12340,,00,00,+0800,0,20090214093254,11F0$"));
verifyAttributes(decoder, text(