aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-02-07 07:24:17 +1000
committerAnton Tananaev <anton.tananaev@gmail.com>2016-02-07 07:24:17 +1000
commit6153dceed18c7ae510cc1d71c407a0cc796dfefe (patch)
treeffbb8077bafcb8b5f905cc36b9e762f6491be4ea
parenta8c6a98f80858f2e04753086c1877c75f5abcf80 (diff)
downloadtrackermap-server-6153dceed18c7ae510cc1d71c407a0cc796dfefe.tar.gz
trackermap-server-6153dceed18c7ae510cc1d71c407a0cc796dfefe.tar.bz2
trackermap-server-6153dceed18c7ae510cc1d71c407a0cc796dfefe.zip
Support new TLT-2H message format
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java6
-rw-r--r--test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index 5f44bd989..802b00f1f 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -35,7 +35,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_HEADER = new PatternBuilder()
.number("#(d+)#") // imei
- .expression("[^#]+#")
+ .expression("[^#]*#")
.number("d+#")
.expression("([^#]+)#") // status
.number("d+") // number of records
@@ -50,8 +50,8 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
.expression("([NS]),")
.number("(d+)(dd.d+),") // longitude
.number("([EW]),")
- .number("(d+.d+)?,") // speed
- .number("(d+.d+)?,") // course
+ .number("(d+.?d*)?,") // speed
+ .number("(d+.?d*)?,") // course
.number("(dd)(dd)(dd)") // date (ddmmyy)
.any()
.compile();
diff --git a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
index 438dc057c..c4fbdcdf4 100644
--- a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
@@ -11,6 +11,10 @@ public class Tlt2hProtocolDecoderTest extends ProtocolTest {
Tlt2hProtocolDecoder decoder = new Tlt2hProtocolDecoder(new Tlt2hProtocol());
verifyPositions(decoder, text(
+ "#357671030108689##0000#AUTO#1\r\n",
+ "#13AE2F8F$GPRMC,211452.000,A,0017.378794,S,03603.441981,E,0.000,0,060216,,,A*68\r\n"));
+
+ verifyPositions(decoder, text(
"#357671030946351#V500#0000#AUTO#1\r\n",
"#$GPRMC,223835.000,A,0615.3545,S,10708.5779,E,14.62,97.41,070313,,,D*70\r\n"),
position("2013-03-07 22:38:35.000", true, -6.25591, 107.14297));