aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/TaipProtocolDecoder.java16
-rw-r--r--test/org/traccar/protocol/TaipProtocolDecoderTest.java3
2 files changed, 17 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;
diff --git a/test/org/traccar/protocol/TaipProtocolDecoderTest.java b/test/org/traccar/protocol/TaipProtocolDecoderTest.java
index 2251763cc..6d24a504f 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());
verifyPosition(decoder, text(
+ ">REV011958000369+0307185+1016144400000032;IO=200;SV=9;BL=4158;CF=0,0,0;AD=12347;IX=10213040;FF=0,0,0,0;VO=338572;ID=357042063052352<"));
+
+ verifyPosition(decoder, text(
">REV421942237017+1170957-0701880200000032;ID=356612022463055<"));
verifyPosition(decoder, text(