Skip to content

Commit

Permalink
Fix Lantrix ACK (fix traccar#5394)
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Oct 2, 2024
1 parent 3d05d50 commit a11be97
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/org/traccar/protocol/TaipProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,14 @@ private Position decodeAttributes(
response = ">SAK;ID=" + uniqueId + ";" + messageIndex + "<";
} else {
if (indexFirst) {
response = ">ACK;" + messageIndex + ";ID=" + uniqueId + ";*";
response = ">ACK;" + messageIndex + ";ID=" + uniqueId + ";";
} else {
response = ">ACK;ID=" + uniqueId + ";" + messageIndex + ";*";
response = ">ACK;ID=" + uniqueId + ";" + messageIndex + ";";
}
response += String.format("%02X", Checksum.xor(response)) + "<";
String model = getDeviceModel(deviceSession);
boolean lantrix = model != null && model.toUpperCase().startsWith("LANTRIX");
int checksum = Checksum.xor(lantrix ? response : response + "*");
response += String.format("*%02X", checksum) + "<";
}
channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
} else {
Expand Down

0 comments on commit a11be97

Please sign in to comment.