aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-04-17 12:43:54 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-04-17 12:43:54 +1200
commit73ecddc51d9c998e08ffa85d54a8e6da90567f36 (patch)
tree742d6e156d5ecc1ea70187970235e313c2357bbd
parente6975cd0c6d93dc205eac0c5470d3060269df87e (diff)
downloadtrackermap-server-73ecddc51d9c998e08ffa85d54a8e6da90567f36.tar.gz
trackermap-server-73ecddc51d9c998e08ffa85d54a8e6da90567f36.tar.bz2
trackermap-server-73ecddc51d9c998e08ffa85d54a8e6da90567f36.zip
Fix TLT2H time regex pattern
-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 9f0e8e888..1d6093b94 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 Anton Tananaev (anton@traccar.org)
+ * Copyright 2013 - 2017 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_POSITION = new PatternBuilder()
.number("#(x+)?") // cell info
.text("$GPRMC,")
- .number("(dd)(dd)(dd).(ddd),") // time (hhmmss.sss)
+ .number("(dd)(dd)(dd).d+,") // time (hhmmss.sss)
.expression("([AV]),") // validity
.number("(d+)(dd.d+),") // latitude
.expression("([NS]),")
@@ -91,7 +91,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
parser.next(); // base station info
DateBuilder dateBuilder = new DateBuilder()
- .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt(), parser.nextInt());
+ .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setValid(parser.next().equals("A"));
position.setLatitude(parser.nextCoordinate());
diff --git a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
index c4fbdcdf4..6c3f9df42 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(
+ "#863835026938048#MT500#0000#AUTO#1\r\n",
+ "#67904917c0e$GPRMC,173926.00,A,4247.8476,N,08342.6996,W,0.03,,160417,,,A*59\r\n"));
+
+ 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"));