From e18e320d47c18414d192affb145af53e03dc00c7 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 9 Feb 2016 21:22:55 +1000 Subject: Add TRV protocol unit tests --- test/org/traccar/protocol/TrvProtocolDecoderTest.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/org/traccar/protocol/TrvProtocolDecoderTest.java') diff --git a/test/org/traccar/protocol/TrvProtocolDecoderTest.java b/test/org/traccar/protocol/TrvProtocolDecoderTest.java index 037254486..b77c848a6 100644 --- a/test/org/traccar/protocol/TrvProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TrvProtocolDecoderTest.java @@ -16,6 +16,12 @@ public class TrvProtocolDecoderTest extends ProtocolTest { verifyAttributes(decoder, text( "TRVCP01,06000908000102")); + verifyAttributes(decoder, text( + "TRVCP01,100007100000001020151060011")); + + verifyPosition(decoder, text( + "TRVAP01160209A2540.8863N05546.6125E005.6075734123.7910000810010000,424,030,3012,27323")); + verifyPosition(decoder, text( "TRVAP01080524A2232.9806N11404.9355E000.1061830323.8706000908000102,460,0,9520,3671")); -- cgit v1.2.3 From 538b2eca6dd2e317376e5161efa7ff0f1fbf9662 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 12 Feb 2016 08:42:16 +1100 Subject: Make TRV course format more flexible --- src/org/traccar/protocol/TrvProtocolDecoder.java | 2 +- test/org/traccar/protocol/TrvProtocolDecoderTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'test/org/traccar/protocol/TrvProtocolDecoderTest.java') diff --git a/src/org/traccar/protocol/TrvProtocolDecoder.java b/src/org/traccar/protocol/TrvProtocolDecoder.java index c81dd08b9..94796fa5e 100644 --- a/src/org/traccar/protocol/TrvProtocolDecoder.java +++ b/src/org/traccar/protocol/TrvProtocolDecoder.java @@ -44,7 +44,7 @@ public class TrvProtocolDecoder extends BaseProtocolDecoder { .expression("([EW])") .number("(ddd.d)") // speed .number("(dd)(dd)(dd)") // time - .number("(ddd.dd)") // course + .number("([d.]{6})") // course .number("(ddd)") // gsm .number("(ddd)") // satellites .number("(ddd)") // battery diff --git a/test/org/traccar/protocol/TrvProtocolDecoderTest.java b/test/org/traccar/protocol/TrvProtocolDecoderTest.java index b77c848a6..13ff61792 100644 --- a/test/org/traccar/protocol/TrvProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TrvProtocolDecoderTest.java @@ -19,6 +19,9 @@ public class TrvProtocolDecoderTest extends ProtocolTest { verifyAttributes(decoder, text( "TRVCP01,100007100000001020151060011")); + verifyPosition(decoder, text( + "TRVAP01160211A2544.5118N05553.7586E105.711185941.52010001010010000,424,030,3011,27003")); + verifyPosition(decoder, text( "TRVAP01160209A2540.8863N05546.6125E005.6075734123.7910000810010000,424,030,3012,27323")); -- cgit v1.2.3