diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/TaipProtocolDecoder.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/TaipProtocolDecoder.java b/src/org/traccar/protocol/TaipProtocolDecoder.java index 7702a89fb..a08bb6f2b 100644 --- a/src/org/traccar/protocol/TaipProtocolDecoder.java +++ b/src/org/traccar/protocol/TaipProtocolDecoder.java @@ -104,15 +104,21 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { Position position = new Position(); position.setProtocol(getProtocolName()); + Integer event = null; + if (parser.hasNext(3)) { - position.set(Position.KEY_EVENT, parser.nextInt(0)); + event = parser.nextInt(); position.setTime(getTime(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0))); } else if (parser.hasNext()) { position.setTime(getTime(parser.nextInt(0))); } if (parser.hasNext()) { - position.set(Position.KEY_EVENT, parser.nextInt(0)); + event = parser.nextInt(); + } + + if (event != null) { + position.set(Position.KEY_EVENT, event); } if (parser.hasNext(6)) { @@ -150,6 +156,12 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { attributes = sentence.substring(beginIndex, endIndex).split(";"); } + return decodeAttributes(channel, remoteAddress, position, attributes); + } + + private Position decodeAttributes( + Channel channel, SocketAddress remoteAddress, Position position, String[] attributes) { + String uniqueId = null; DeviceSession deviceSession = null; String messageIndex = null; |