diff options
-rw-r--r-- | src/org/traccar/protocol/TaipProtocolDecoder.java | 11 | ||||
-rw-r--r-- | test/org/traccar/protocol/TaipProtocolDecoderTest.java | 3 |
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( |