diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-21 21:10:26 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-21 21:10:26 +1200 |
commit | 2f6967e7e53b70bfb0f8e20df2b6b351b8b817cb (patch) | |
tree | 0f45e3b5576a7d375b08856fe0bc056cfc27c1da | |
parent | 67c2a69c1ea041f5f42f863396cad0927be9d82b (diff) | |
download | trackermap-server-2f6967e7e53b70bfb0f8e20df2b6b351b8b817cb.tar.gz trackermap-server-2f6967e7e53b70bfb0f8e20df2b6b351b8b817cb.tar.bz2 trackermap-server-2f6967e7e53b70bfb0f8e20df2b6b351b8b817cb.zip |
Add VTFMS protocol test case
-rw-r--r-- | src/org/traccar/protocol/VtfmsProtocolDecoder.java | 8 | ||||
-rw-r--r-- | test/org/traccar/protocol/VtfmsProtocolDecoderTest.java | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/VtfmsProtocolDecoder.java b/src/org/traccar/protocol/VtfmsProtocolDecoder.java index 9f8cea04f..f4ff941d0 100644 --- a/src/org/traccar/protocol/VtfmsProtocolDecoder.java +++ b/src/org/traccar/protocol/VtfmsProtocolDecoder.java @@ -35,12 +35,12 @@ public class VtfmsProtocolDecoder extends BaseProtocolDecoder { private static final Pattern PATTERN = new PatternBuilder() .text("(") .number("(d{15}),") // imei - .number("[0-9A-Z]{3}dd,") // packet count + .number("[0-9A-Z]{3}dd,") // packet count .number("(dd),") // packet id .number("[^,]*,") // reserved - .number("(d+),") // rssi - .number("d+,") // fix status - .number("(d+),") // satellites + .number("(d+)?,") // rssi + .number("(?:d+)?,") // fix status + .number("(d+)?,") // satellites .number("[^,]*,") // reserved .expression("([AV]),") // validity .number("(dd)(dd)(dd),") // time (hhmmss) diff --git a/test/org/traccar/protocol/VtfmsProtocolDecoderTest.java b/test/org/traccar/protocol/VtfmsProtocolDecoderTest.java index a08bfb926..c2d01aded 100644 --- a/test/org/traccar/protocol/VtfmsProtocolDecoderTest.java +++ b/test/org/traccar/protocol/VtfmsProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class VtfmsProtocolDecoderTest extends ProtocolTest { VtfmsProtocolDecoder decoder = new VtfmsProtocolDecoder(new VtfmsProtocol()); + verifyNull(decoder, text( + "(865733028143493,00I76,00,000,,,,,A,133755,210617,10.57354,077.24912,SW,000,00598,00000,K,0017368,1,12.7,,,0.000,,,0,0,0,0,1,1,0,,)074")); + verifyPosition(decoder, text( "(863071010087648,0HK44,00,000,14,2,9,,A,114946,180313,11.0244,076.9768,282,000,00000,00000,K,0000128,1,12.8,,200,2.501,,4.001,0,0,0,0,0,0,0,,)105")); |