From 5e4b1f4b5dc38bf03a305aefaad5ba30e652d8b8 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 28 May 2021 21:28:40 -0700 Subject: Ack response for all types --- .../org/traccar/protocol/Gl200TextProtocolDecoder.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3