diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-07-14 22:22:52 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-07-14 22:22:52 -0700 |
commit | edeb03b40d04be2c75eb736e35afc3b324da0cf2 (patch) | |
tree | a20333cfeeaf913d553834b70d51a86cc6a8aff0 /src/main/java/org | |
parent | 9d057f8c87af2df410f65e5f70f26c59b3192fcb (diff) | |
download | traccar-server-edeb03b40d04be2c75eb736e35afc3b324da0cf2.tar.gz traccar-server-edeb03b40d04be2c75eb736e35afc3b324da0cf2.tar.bz2 traccar-server-edeb03b40d04be2c75eb736e35afc3b324da0cf2.zip |
Support acknowledgement
Diffstat (limited to 'src/main/java/org')
-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; } |