diff options
Diffstat (limited to 'src/main/java/org/traccar/protocol')
3 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/main/java/org/traccar/protocol/GpsGateProtocolDecoder.java index cc187225b..c158d3212 100644 --- a/src/main/java/org/traccar/protocol/GpsGateProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/GpsGateProtocolDecoder.java @@ -69,7 +69,8 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder { private void send(Channel channel, SocketAddress remoteAddress, String message) { if (channel != null) { - channel.writeAndFlush(new NetworkMessage(message + Checksum.nmea(message) + "\r\n", remoteAddress)); + channel.writeAndFlush(new NetworkMessage( + message + Checksum.nmea(message.substring(1)) + "\r\n", remoteAddress)); } } diff --git a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java index 0c72568f3..4abb75025 100644 --- a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java @@ -152,7 +152,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { if (responseCode != null) { String response = "$AVCFG," + devicePassword + "," + responseCode; - response += Checksum.nmea(response) + "\r\n"; + response += Checksum.nmea(response.substring(1)) + "\r\n"; channel.writeAndFlush(new NetworkMessage(response, remoteAddress)); } @@ -163,7 +163,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { if (Character.isLowerCase(status.charAt(0))) { String response = "$EAVACK," + event + "," + checksum; - response += Checksum.nmea(response) + "\r\n"; + response += Checksum.nmea(response.substring(1)) + "\r\n"; channel.writeAndFlush(new NetworkMessage(response, remoteAddress)); } diff --git a/src/main/java/org/traccar/protocol/LaipacProtocolEncoder.java b/src/main/java/org/traccar/protocol/LaipacProtocolEncoder.java index 0c9f8ebb8..aaa5a70f7 100644 --- a/src/main/java/org/traccar/protocol/LaipacProtocolEncoder.java +++ b/src/main/java/org/traccar/protocol/LaipacProtocolEncoder.java @@ -29,7 +29,7 @@ public class LaipacProtocolEncoder extends StringProtocolEncoder { @Override protected String formatCommand(Command command, String format, String... keys) { String sentence = super.formatCommand(command, "$" + format, keys); - sentence += Checksum.nmea(sentence) + "\r\n"; + sentence += Checksum.nmea(sentence.substring(1)) + "\r\n"; return sentence; } |