aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/TaipProtocolDecoder.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java b/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java
index 72090df8b..e953756b5 100644
--- a/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java
@@ -264,6 +264,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
String uniqueId = null;
DeviceSession deviceSession = null;
String messageIndex = null;
+ boolean indexFirst = true;
if (attributes != null) {
for (String attribute : attributes) {
@@ -278,6 +279,9 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
if (deviceSession != null) {
position.setDeviceId(deviceSession.getDeviceId());
}
+ if (messageIndex == null) {
+ indexFirst = false;
+ }
break;
case "io":
position.set(Position.KEY_IGNITION, BitUtil.check(value.charAt(0) - '0', 0));
@@ -317,7 +321,11 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
if (messageIndex.startsWith("#IP")) {
response = ">SAK;ID=" + uniqueId + ";" + messageIndex + "<";
} else {
- response = ">ACK;" + messageIndex + ";ID=" + uniqueId + ";*";
+ if (indexFirst) {
+ response = ">ACK;" + messageIndex + ";ID=" + uniqueId + ";*";
+ } else {
+ response = ">ACK;ID=" + uniqueId + ";" + messageIndex + ";*";
+ }
response += String.format("%02X", Checksum.xor(response)) + "<";
}
channel.writeAndFlush(new NetworkMessage(response, remoteAddress));