diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-04-28 10:07:46 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-04-28 10:07:46 +1200 |
commit | 7e121784cc9fc79d058f2bdc5bd631a027e7c455 (patch) | |
tree | 92dc6a0854152a4e26e13bdc13f29cc982c1e0b0 /src/org/traccar/protocol | |
parent | 4aea55186a2374350f825cf2008847ce4c5ae87c (diff) | |
download | traccar-server-7e121784cc9fc79d058f2bdc5bd631a027e7c455.tar.gz traccar-server-7e121784cc9fc79d058f2bdc5bd631a027e7c455.tar.bz2 traccar-server-7e121784cc9fc79d058f2bdc5bd631a027e7c455.zip |
Atrack always send ack
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/AtrackProtocolDecoder.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index ac208c0f2..b0f094103 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -21,6 +21,7 @@ import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.DeviceSession; +import org.traccar.helper.DataConverter; import org.traccar.helper.DateBuilder; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; @@ -410,16 +411,21 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { return positions; } + private void sendResponse(Channel channel, SocketAddress remoteAddress) { + if (channel != null) { + channel.write(ChannelBuffers.wrappedBuffer(DataConverter.parseHex("fe02")), remoteAddress); + } + } + @Override protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { ChannelBuffer buf = (ChannelBuffer) msg; + sendResponse(channel, remoteAddress); + if (buf.getUnsignedShort(buf.readerIndex()) == 0xfe02) { - if (channel != null) { - channel.write(buf, remoteAddress); // keep-alive message - } return null; } else if (buf.getByte(buf.readerIndex()) == '$') { return decodeInfo(channel, remoteAddress, buf.toString(StandardCharsets.US_ASCII).trim()); |