From 2f6967e7e53b70bfb0f8e20df2b6b351b8b817cb Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 21 Jun 2017 21:10:26 +1200 Subject: Add VTFMS protocol test case --- src/org/traccar/protocol/VtfmsProtocolDecoder.java | 8 ++++---- 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")); -- cgit v1.2.3