diff options
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java index 126656361..683ba476e 100644 --- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -1161,10 +1161,6 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { decodeDeviceTime(position, parser); - if (channel != null && Context.getConfig().getBoolean(Keys.PROTOCOL_ACK.withPrefix(getProtocolName()))) { - channel.writeAndFlush(new NetworkMessage("+SACK:" + parser.next() + "$", remoteAddress)); - } - return position; } @@ -1329,6 +1325,16 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { } } + if (channel != null && Context.getConfig().getBoolean(Keys.PROTOCOL_ACK.withPrefix(getProtocolName()))) { + String checksum; + if (sentence.endsWith("$")) { + checksum = sentence.substring(sentence.length() - 1 - 4, sentence.length() - 1); + } else { + checksum = sentence.substring(sentence.length() - 4); + } + channel.writeAndFlush(new NetworkMessage("+SACK:" + checksum + "$", remoteAddress)); + } + return result; } |