From b7d5d53ead8eb8f7dbe6e04cdee76ea2c05c1dbe Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 29 Mar 2017 00:44:06 +1300 Subject: Add support for TAIP event code --- src/org/traccar/protocol/TaipProtocolDecoder.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') 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)); } -- cgit v1.2.3