aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java16
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java3
2 files changed, 18 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 7e76fd6c9..a6da38ef4 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -217,7 +217,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
.number("(x+)?,") // adc 2
.number("(d{1,3})?,") // battery
.number("(?:(xx)(xx)(xx))?,") // device status
- .any()
+ .expression("(.*)") // additional data
.number("(dddd)(dd)(dd)") // date (yyyymmdd)
.number("(dd)(dd)(dd)").optional(2) // time (hhmmss)
.text(",")
@@ -601,6 +601,20 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
decodeStatus(position, parser);
+ int index = 0;
+ String[] data = parser.next().split(",");
+ if (data.length > 1) {
+ int deviceType = Integer.parseInt(data[index++]);
+ if (deviceType == 2) {
+ int deviceCount = Integer.parseInt(data[index++]);
+ for (int i = 1; i <= deviceCount; i++) {
+ index++; // id
+ index++; // type
+ position.set(Position.PREFIX_TEMP + i, Short.parseShort(data[index++], 16) * 0.0625);
+ }
+ }
+ }
+
decodeDeviceTime(position, parser);
return positions;
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index 90ecf8ef9..5d6c2aca8 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class Gl200ProtocolDecoderTest extends ProtocolTest {
Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new Gl200Protocol());
+ verifyPositions(decoder, text(
+ "+RESP:GTERI,060800,861074023677175,,00000002,12351,10,1,1,0.0,0,2862.4,-78.467273,-0.164998,20170529181717,,,,,,0.0,00259:11:50,,,0,210104,2,1,28E17436060000E2,1,015F,0,20170529181723,2824$"));
+
verifyPosition(decoder, text(
"+RESP:GTSWG,110100,358688000000158,,1,0,2.1,0,27.1,121.390717,31.164424,20110901073917,0460,0000,1878,0873,,20110901154653,0015$"));