aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-11-18 06:10:11 -0800
committerAnton Tananaev <anton@traccar.org>2023-11-18 06:10:11 -0800
commita7a5e0ad20d707e7f3527503ed124c6986118e87 (patch)
treef52899c782100e2ce2405716a24ba94db0a7a864 /src
parentb3463d2bb53dbb31d8b4aae58444fca353a3eca9 (diff)
downloadtrackermap-server-a7a5e0ad20d707e7f3527503ed124c6986118e87.tar.gz
trackermap-server-a7a5e0ad20d707e7f3527503ed124c6986118e87.tar.bz2
trackermap-server-a7a5e0ad20d707e7f3527503ed124c6986118e87.zip
Modify TAIP ACK order
Diffstat (limited to 'src')
-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));