diff options
author | Santosh <santushet@gmail.com> | 2016-10-03 18:53:45 +0530 |
---|---|---|
committer | Santosh <santushet@gmail.com> | 2016-10-14 10:33:39 +0530 |
commit | 6b16be4ae85d6d2ee4e182a82a9ca3ef1173a27e (patch) | |
tree | 1facdd549e57742c3827bb5da99427624374f645 /src/org/traccar/protocol/TkmateProtocol.java | |
parent | 46d286fbe1d023c8cfee78f876e8f9612249927b (diff) | |
download | trackermap-server-6b16be4ae85d6d2ee4e182a82a9ca3ef1173a27e.tar.gz trackermap-server-6b16be4ae85d6d2ee4e182a82a9ca3ef1173a27e.tar.bz2 trackermap-server-6b16be4ae85d6d2ee4e182a82a9ca3ef1173a27e.zip |
Implement trakmate protocol
Diffstat (limited to 'src/org/traccar/protocol/TkmateProtocol.java')
-rw-r--r-- | src/org/traccar/protocol/TkmateProtocol.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/TkmateProtocol.java b/src/org/traccar/protocol/TkmateProtocol.java new file mode 100644 index 000000000..156718aaa --- /dev/null +++ b/src/org/traccar/protocol/TkmateProtocol.java @@ -0,0 +1,32 @@ +package org.traccar.protocol; + +import org.jboss.netty.bootstrap.ServerBootstrap; +import org.jboss.netty.channel.ChannelPipeline; +import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; +import org.traccar.BaseProtocol; +import org.traccar.CharacterDelimiterFrameDecoder; +import org.traccar.TrackerServer; + +import java.util.List; + + +public class TkmateProtocol extends BaseProtocol { + + public TkmateProtocol() { + super("trakmate"); + } + + @Override + public void initTrackerServers(List<TrackerServer> serverList) { + serverList.add(new TrackerServer(new ServerBootstrap(), getName()) { + @Override + protected void addSpecificHandlers(ChannelPipeline pipeline) { + pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, "#")); + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); + pipeline.addLast("objectDecoder", new TkmateProtocolDecoder(TkmateProtocol.this)); + } + }); + } +} |