diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-01-08 18:59:38 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-01-08 18:59:45 -0800 |
commit | 7472cc0f97cf3d58fa9674881114f59fc5287676 (patch) | |
tree | bd49e7fc5f152e9e705d46f75d9194db22db0beb | |
parent | 1d10aeb4671943f851026cb248e7ef24a022174c (diff) | |
download | traccar-server-7472cc0f97cf3d58fa9674881114f59fc5287676.tar.gz traccar-server-7472cc0f97cf3d58fa9674881114f59fc5287676.tar.bz2 traccar-server-7472cc0f97cf3d58fa9674881114f59fc5287676.zip |
Add ITS login response
-rw-r--r-- | src/org/traccar/protocol/ItsProtocolDecoder.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/ItsProtocolDecoder.java b/src/org/traccar/protocol/ItsProtocolDecoder.java index d3cdb14c3..000e7759f 100644 --- a/src/org/traccar/protocol/ItsProtocolDecoder.java +++ b/src/org/traccar/protocol/ItsProtocolDecoder.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.Parser; import org.traccar.helper.PatternBuilder; @@ -72,7 +73,13 @@ public class ItsProtocolDecoder extends BaseProtocolDecoder { protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { - Parser parser = new Parser(PATTERN, (String) msg); + String sentence = (String) msg; + + if (channel != null && sentence.startsWith("$,01,")) { + channel.writeAndFlush(new NetworkMessage("$,01,", remoteAddress)); + } + + Parser parser = new Parser(PATTERN, sentence); if (!parser.matches()) { return null; } |