aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-12-21 23:26:13 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-12-21 23:26:13 -0800
commit25dfb6a1fb66f5565ec338928d000d271f7e62db (patch)
tree3692da8a39f7b5b42aa57dfb5e7d3b2470420c7f /src/main/java/org
parent80defa745c10ba5a43fbc0b05f66b5567d782348 (diff)
downloadtrackermap-server-25dfb6a1fb66f5565ec338928d000d271f7e62db.tar.gz
trackermap-server-25dfb6a1fb66f5565ec338928d000d271f7e62db.tar.bz2
trackermap-server-25dfb6a1fb66f5565ec338928d000d271f7e62db.zip
Encode response message
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/TzoneProtocolDecoder.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/TzoneProtocolDecoder.java b/src/main/java/org/traccar/protocol/TzoneProtocolDecoder.java
index 9e04f0b02..819c42471 100644
--- a/src/main/java/org/traccar/protocol/TzoneProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TzoneProtocolDecoder.java
@@ -17,6 +17,7 @@ package org.traccar.protocol;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
+import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
@@ -33,6 +34,7 @@ import org.traccar.model.Network;
import org.traccar.model.Position;
import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -51,8 +53,10 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder {
String ack = String.format("@ACK,%d#", index);
String time = String.format("@UTC time:%s", dateFormat.format(new Date()));
+ ByteBuf response = Unpooled.copiedBuffer(ack + time, StandardCharsets.US_ASCII);
+
if (channel != null) {
- channel.writeAndFlush(new NetworkMessage(ack + time, remoteAddress));
+ channel.writeAndFlush(new NetworkMessage(response, remoteAddress));
}
}