aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-03-29 00:44:06 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-03-29 00:44:07 +1300
commitb7d5d53ead8eb8f7dbe6e04cdee76ea2c05c1dbe (patch)
tree8c6dacc48183ab72a444c2a8f47fd49b812c3c77
parent06b40d5341c846716bd0217e42df7031f460989c (diff)
downloadtrackermap-server-b7d5d53ead8eb8f7dbe6e04cdee76ea2c05c1dbe.tar.gz
trackermap-server-b7d5d53ead8eb8f7dbe6e04cdee76ea2c05c1dbe.tar.bz2
trackermap-server-b7d5d53ead8eb8f7dbe6e04cdee76ea2c05c1dbe.zip
Add support for TAIP event code
-rw-r--r--src/org/traccar/protocol/TaipProtocolDecoder.java11
-rw-r--r--test/org/traccar/protocol/TaipProtocolDecoderTest.java3
2 files changed, 11 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/TaipProtocolDecoder.java b/src/org/traccar/protocol/TaipProtocolDecoder.java
index a46cdefe3..34e7c6351 100644
--- a/src/org/traccar/protocol/TaipProtocolDecoder.java
+++ b/src/org/traccar/protocol/TaipProtocolDecoder.java
@@ -43,14 +43,14 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
.groupBegin()
.expression("R[EP]V") // type
.groupBegin()
- .number("dd") // event index
+ .number("(dd)") // event
.number("(dddd)") // week
.number("(d)") // day
.groupEnd("?")
.number("(d{5})") // seconds
.or()
.expression("(?:RGP|RCQ|RBR)") // type
- .number("(?:dd)?")
+ .number("(dd)?") // event
.number("(dd)(dd)(dd)") // date (mmddyy)
.number("(dd)(dd)(dd)") // time (hhmmss)
.groupEnd()
@@ -107,12 +107,17 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position();
position.setProtocol(getProtocolName());
- if (parser.hasNext(2)) {
+ if (parser.hasNext(3)) {
+ position.set(Position.KEY_EVENT, parser.nextInt());
position.setTime(getTime(parser.nextInt(), parser.nextInt(), parser.nextInt()));
} else if (parser.hasNext()) {
position.setTime(getTime(parser.nextInt()));
}
+ if (parser.hasNext()) {
+ position.set(Position.KEY_EVENT, parser.nextInt());
+ }
+
if (parser.hasNext(6)) {
position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
}
diff --git a/test/org/traccar/protocol/TaipProtocolDecoderTest.java b/test/org/traccar/protocol/TaipProtocolDecoderTest.java
index 121ffa5a6..a088cff9c 100644
--- a/test/org/traccar/protocol/TaipProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TaipProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class TaipProtocolDecoderTest extends ProtocolTest {
TaipProtocolDecoder decoder = new TaipProtocolDecoder(new TaipProtocol(), false);
verifyPosition(decoder, text(
+ ">REV421942237017+1170957-0701880200000032;ID=356612022463055<"));
+
+ verifyPosition(decoder, text(
">RGP200317010815-3852.9306-06204.88560000003000101;&01;ID=5555;#7AD7*51<"));
verifyPosition(decoder, text(