aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-06 11:45:58 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-06 11:45:58 +1200
commit0549b3ffd07d10d48f35434034a01d1504585df5 (patch)
tree66fb97648fde1569a3777c0e01e0015dc1f2ef85
parentb16f2be8393581cd516bf8b6c3d188cd6073a80c (diff)
downloadtraccar-server-0549b3ffd07d10d48f35434034a01d1504585df5.tar.gz
traccar-server-0549b3ffd07d10d48f35434034a01d1504585df5.tar.bz2
traccar-server-0549b3ffd07d10d48f35434034a01d1504585df5.zip
Support TT8850 device (fix #880)
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java6
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java18
2 files changed, 22 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 0ce8bff5e..38ecdf4f3 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -37,8 +37,10 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
}
private static final Pattern pattern = Pattern.compile(
- "\\+(?:RESP|BUFF):GT...," +
- "[0-9a-fA-F]{6}," + // Protocol version
+ "(?:(?:\\+(?:RESP|BUFF):)|" +
+ "(?:\\x00\\x04,\\p{XDigit}{4},[01],))" +
+ "GT...," +
+ "(?:[0-9a-fA-F]{6})?," + // Protocol version
"(\\d{15}),.*," + // IMEI
"(\\d*)," + // GPS accuracy
"(\\d+.\\d)?," + // Speed
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index e57ad8007..f30f08a63 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -95,7 +95,25 @@ public class Gl200ProtocolDecoderTest {
verify(decoder.decode(null, null,
"+RESP:GTFRI,240100,135790246811220,,,10,2,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,0,4.3,92,70.0,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,2000.0,12345:12:34,,,80,,,,,,20090214093254,11F0$"));
+
+ verify(decoder.decode(null, null,
+ "\u0000\u0004,005F,0,GTFRI,020100,135790246811220,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,90,20090214093254,11F0$"));
+
+ verify(decoder.decode(null, null,
+ "\u0000\u0004,005F,0,GTGEO,020100,135790246811220,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,90,20090214093254,11F0$"));
+
+ verify(decoder.decode(null, null,
+ "\u0000\u0004,005F,0,GTNMR,020100,135790246811220,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,90,20090214093254,11F0$"));
+
+ verify(decoder.decode(null, null,
+ "\u0000\u0004,0017,0,GTNMR,,867844000400914,,0,41,1,2,0.0,0,1504.2,-75.569202,6.242850,20150404162835,,,,,97,20150404162836,05EF$"));
+
+ assertNull(decoder.decode(null, null,
+ "\u0000\u0004,0017,0,GTPNA,,867844000400914,,0,0,1,0,,,,0,0,,,,,,99,20150404190153,0601$"));
+ verify(decoder.decode(null, null,
+ "\u0000\u0004,0017,0,GTEPN,,867844000400914,,0,0,1,0,0.0,0,1717.4,-75.598445,6.278578,20150405003116,,,,,95,20150405003358,0607$"));
+
}
}