From edeb03b40d04be2c75eb736e35afc3b324da0cf2 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 14 Jul 2020 22:22:52 -0700 Subject: Support acknowledgement --- .../java/org/traccar/protocol/EasyTrackProtocolDecoder.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/main/java/org/traccar/protocol') diff --git a/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java index 81a31e1d1..889e2bf09 100644 --- a/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import io.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; +import org.traccar.NetworkMessage; import org.traccar.Protocol; import org.traccar.helper.BitUtil; import org.traccar.helper.DateBuilder; @@ -93,7 +94,14 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder { protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { - Parser parser = new Parser(PATTERN, (String) msg); + String sentence = (String) msg; + String type = sentence.substring(20, 22); + + if (type.equals("TX") && channel != null) { + channel.writeAndFlush(new NetworkMessage(sentence + "#", remoteAddress)); + } + + Parser parser = new Parser(PATTERN, sentence); if (!parser.matches()) { return null; } -- cgit v1.2.3