aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-08-17 14:10:19 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-08-17 14:10:19 +1200
commit24c04679c356f21d82419d9cb4f2bcd256653132 (patch)
treea77655000b5dcaa4fd4cdeaa057d2afd9bb527b0
parenta4a40243616cb2d29ca70f61dbca8502d343357a (diff)
downloadtraccar-server-24c04679c356f21d82419d9cb4f2bcd256653132.tar.gz
traccar-server-24c04679c356f21d82419d9cb4f2bcd256653132.tar.bz2
traccar-server-24c04679c356f21d82419d9cb4f2bcd256653132.zip
Improve T55 regex pattern
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/T55ProtocolDecoderTest.java8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java
index 63444ccd4..1376ca123 100644
--- a/src/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/org/traccar/protocol/T55ProtocolDecoder.java
@@ -50,9 +50,9 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern patternGPGGA = Pattern.compile(
"\\$GPGGA," +
"(\\d{2})(\\d{2})(\\d{2})\\.?\\d*," + // Time
- "(\\d{2})(\\d{2}\\.\\d+)," + // Latitude
+ "(\\d+)(\\d{2}\\.\\d+)," + // Latitude
"([NS])," +
- "(\\d{3})(\\d{2}\\.\\d+)," + // Longitude
+ "(\\d+)(\\d{2}\\.\\d+)," + // Longitude
"([EW])," +
".+");
diff --git a/test/org/traccar/protocol/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/T55ProtocolDecoderTest.java
index e967671f5..2aa82f400 100644
--- a/test/org/traccar/protocol/T55ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/T55ProtocolDecoderTest.java
@@ -11,7 +11,7 @@ public class T55ProtocolDecoderTest extends ProtocolDecoderTest {
public void testDecode() throws Exception {
T55ProtocolDecoder decoder = new T55ProtocolDecoder(new T55Protocol());
-
+
assertNull(decoder.decode(null, null, "$GPFID,ID123456ABC"));
assertNull(decoder.decode(null, null, "$PGID,359853000144328*0F"));
@@ -59,6 +59,12 @@ public class T55ProtocolDecoderTest extends ProtocolDecoderTest {
verify(decoder.decode(null, null,
"990000561287964,$GPRMC,213516.0,A,4337.216791,N,11611.995877,W,0.0,335.4,181214,,,A * 72"));
+ verify(decoder.decode(null, null,
+ "355096030432529$GPGGA,000000.00,3136.599,S,5213.981,W,1,7,2.13,250.00,M,-16.384,M,3550960304325290.0,1"));
+
+ verify(decoder.decode(null, null,
+ "355096030432529$GPGGA,000000.00,3136.628,S,5213.990,W,1,7,2.13,250.00,M,-16.384,M,0.0,1"));
+
}
}