diff options
Diffstat (limited to 'src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/EasyTrackProtocolDecoder.java | 10 |
1 files changed, 9 insertions, 1 deletions
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; } |