diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-27 17:26:33 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-27 17:26:33 +1200 |
commit | d15ed63e4d276737a88e849c27af2876bf56a82e (patch) | |
tree | 7d96cb4c70b4de846cb991feed3a4b2c4a618227 | |
parent | d211474d2951d9b8e8d233b80b22419a21e2c6e1 (diff) | |
download | trackermap-server-d15ed63e4d276737a88e849c27af2876bf56a82e.tar.gz trackermap-server-d15ed63e4d276737a88e849c27af2876bf56a82e.tar.bz2 trackermap-server-d15ed63e4d276737a88e849c27af2876bf56a82e.zip |
Fix TR900 regex pattern (fix #1246)
-rw-r--r-- | src/org/traccar/protocol/Tr900ProtocolDecoder.java | 13 | ||||
-rw-r--r-- | test/org/traccar/protocol/Tr900ProtocolDecoderTest.java | 9 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/Tr900ProtocolDecoder.java b/src/org/traccar/protocol/Tr900ProtocolDecoder.java index e5674b262..fadca5fc6 100644 --- a/src/org/traccar/protocol/Tr900ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tr900ProtocolDecoder.java @@ -15,17 +15,16 @@ */ package org.traccar.protocol; -import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.ChannelHandlerContext; -import org.traccar.BaseProtocolDecoder; -import org.traccar.model.Event; -import org.traccar.model.Position; - import java.net.SocketAddress; import java.util.Calendar; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.traccar.BaseProtocolDecoder; +import org.traccar.model.Event; +import org.traccar.model.Position; public class Tr900ProtocolDecoder extends BaseProtocolDecoder { @@ -53,7 +52,7 @@ public class Tr900ProtocolDecoder extends BaseProtocolDecoder { "\\d+," + // Impulses "(\\d+)," + // Input "(\\d+)" + // Status - ".*"); + ".*(?:\r\n)?"); @Override protected Object decode( diff --git a/test/org/traccar/protocol/Tr900ProtocolDecoderTest.java b/test/org/traccar/protocol/Tr900ProtocolDecoderTest.java index 5835a508b..c8cd8d99c 100644 --- a/test/org/traccar/protocol/Tr900ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tr900ProtocolDecoderTest.java @@ -1,9 +1,6 @@ package org.traccar.protocol; import org.junit.Test; -import org.traccar.helper.TestDataManager; - -import static org.junit.Assert.assertNull; import static org.traccar.helper.DecoderVerifier.verify; public class Tr900ProtocolDecoderTest extends ProtocolDecoderTest { @@ -14,8 +11,14 @@ public class Tr900ProtocolDecoderTest extends ProtocolDecoderTest { Tr900ProtocolDecoder decoder = new Tr900ProtocolDecoder(null); verify(decoder.decode(null, null, null, + ">00001001,4,1,150626,131252,W05830.2978,S3137.2783,,00,348,18,00,003-000,0,3,11111011*3b!")); + + verify(decoder.decode(null, null, null, ">12345678,1,1,070201,144111,W05829.2613,S3435.2313,,00,034,25,00,126-000,0,3,11111111*2d!")); + verify(decoder.decode(null, null, null, + ">00001001,4,1,150626,131252,W05830.2978,S3137.2783,,00,348,18,00,003-000,0,3,11111011*3b!\r\n")); + } } |