From 3f8c59f633f430e477d27301f2358499906fb21a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 29 Aug 2013 20:32:10 +1200 Subject: Fix GPS103 decoder (fix #371) --- src/org/traccar/protocol/Gps103ProtocolDecoder.java | 8 ++------ test/org/traccar/protocol/Gps103ProtocolDecoderTest.java | 3 +++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 845aa9a8b..cd6dbdcd0 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -33,9 +33,6 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { super(serverManager); } - /** - * Regular expressions pattern - */ static private Pattern pattern = Pattern.compile( "imei:" + "(\\d+)," + // IMEI @@ -46,9 +43,9 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { "[FL]," + // F - full / L - low "(\\d{2})(\\d{2})(\\d{2})\\.(\\d{3})," + // Time UTC (HHMMSS.SSS) "([AV])," + // Validity - "(\\d{2})(\\d{2}\\.\\d{4})," + // Latitude (DDMM.MMMM) + "(\\d+)(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM) "([NS])," + - "(\\d{3})(\\d{2}\\.\\d{4})," + // Longitude (DDDMM.MMMM) + "(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM) "([EW])?," + "(\\d+\\.?\\d*)," + // Speed "(\\d+\\.\\d+)?" + // Course @@ -80,7 +77,6 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { // Parse message Matcher parser = pattern.matcher(sentence); if (!parser.matches()) { - Log.info("Parsing error"); return null; } diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java index 42f79b26a..46f79cacd 100644 --- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java @@ -20,6 +20,9 @@ public class Gps103ProtocolDecoderTest { // No GPS signal assertNull(decoder.decode(null, null, "imei:359586015829802,tracker,000000000,13554900601,L,;")); + + assertNotNull(decoder.decode(null, null, + "imei:869039001186913,tracker,1308282156,0,F,215630.000,A,5602.11015,N,9246.30767,E,1.4,,175.9,")); assertNotNull(decoder.decode(null, null, "imei:359710040656622,tracker,13/02/27 23:40,,F,125952.000,A,3450.9430,S,13828.6753,E,0.00,0")); -- cgit v1.2.3