From 60467dccc46dfdd3b32b342ead40652774f96451 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 2 Jun 2021 22:08:28 -0700 Subject: Fix TAIP response --- src/main/java/org/traccar/protocol/TaipPrefixEncoder.java | 4 ++-- src/main/java/org/traccar/protocol/TaipProtocolDecoder.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/traccar/protocol/TaipPrefixEncoder.java b/src/main/java/org/traccar/protocol/TaipPrefixEncoder.java index 3d906ab60..02c111b01 100644 --- a/src/main/java/org/traccar/protocol/TaipPrefixEncoder.java +++ b/src/main/java/org/traccar/protocol/TaipPrefixEncoder.java @@ -38,9 +38,9 @@ public class TaipPrefixEncoder extends MessageToMessageEncoder { @Override protected void encode(ChannelHandlerContext ctx, ByteBuf msg, List out) throws Exception { if (Context.getConfig().getBoolean(Keys.PROTOCOL_PREFIX.withPrefix(protocol.getName()))) { - out.add(Unpooled.wrappedBuffer(Unpooled.wrappedBuffer(new byte[] {0x20, 0x20, 0x06, 0x00}), msg)); + out.add(Unpooled.wrappedBuffer(Unpooled.wrappedBuffer(new byte[] {0x20, 0x20, 0x06, 0x00}), msg.retain())); } else { - out.add(msg); + out.add(msg.retain()); } } diff --git a/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java b/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java index 6f71b6c08..ec0ce1931 100644 --- a/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/TaipProtocolDecoder.java @@ -313,7 +313,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { if (messageIndex != null) { String response; if (messageIndex.startsWith("#IP")) { - response = "\u0020\u0020\u0006\u0000>SAK;ID=" + uniqueId + ";" + messageIndex + "<"; + response = ">SAK;ID=" + uniqueId + ";" + messageIndex + "<"; } else { response = ">ACK;ID=" + uniqueId + ";" + messageIndex + ";*"; response += String.format("%02X", Checksum.xor(response)) + "<"; -- cgit v1.2.3