aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-01-31 00:38:03 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-01-31 00:38:03 +1300
commitdc53f34f5f823fcea8ec3a94c78716262e4fb42f (patch)
tree70332ef5cd31037fa4438c1a0fc7c377c534958f
parent672bad5be540ab114c6739567c130215724c6f05 (diff)
downloadtrackermap-server-dc53f34f5f823fcea8ec3a94c78716262e4fb42f.tar.gz
trackermap-server-dc53f34f5f823fcea8ec3a94c78716262e4fb42f.tar.bz2
trackermap-server-dc53f34f5f823fcea8ec3a94c78716262e4fb42f.zip
Add new MiniFinder message types
-rw-r--r--src/org/traccar/protocol/MiniFinderProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
index eda085bc3..631a4b56b 100644
--- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
+++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
@@ -33,7 +33,7 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
}
private static final Pattern PATTERN = new PatternBuilder()
- .expression("![AD],")
+ .expression("![A-D],")
.number("(d+)/(d+)/(d+),") // date
.number("(d+):(d+):(d+),") // time
.number("(-?d+.d+),") // latitude
@@ -62,7 +62,7 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
identify(sentence.substring(3, sentence.length()), channel, remoteAddress);
- } else if ((sentence.startsWith("!D") || sentence.startsWith("!A")) && hasDeviceId()) {
+ } else if (sentence.matches("![A-D].*") && hasDeviceId()) {
Parser parser = new Parser(PATTERN, sentence);
if (!parser.matches()) {
diff --git a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
index 46d01ac01..2b5bbd574 100644
--- a/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MiniFinderProtocolDecoderTest.java
@@ -20,6 +20,9 @@ public class MiniFinderProtocolDecoderTest extends ProtocolTest {
"!1,860719027585011"));
verifyPosition(decoder, text(
+ "!C,30/1/16,1:1:6,31.259157,30.020910,0,0,100001,25.32,100,0.03,0.01,0"));
+
+ verifyPosition(decoder, text(
"!A,26/10/12,00:28:41,7.770385,-72.215706,0.0,25101,0"));
verifyPosition(decoder, text(