diff options
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r-- | src/org/traccar/ServerManager.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index ca656af73..85aa8b2cc 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -35,6 +35,8 @@ import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder; +import org.jboss.netty.handler.codec.http.HttpRequestDecoder; +import org.jboss.netty.handler.codec.http.HttpResponseEncoder; import org.jboss.netty.handler.codec.string.StringDecoder; import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.geocode.GoogleReverseGeocoder; @@ -129,6 +131,8 @@ public class ServerManager { initGt06Server("gt06"); initMegastekServer("megastek"); initNavigilServer("navigil"); + initMta6Server("mta6"); + initTeltonikaServer("teltonika"); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -606,4 +610,29 @@ public class ServerManager { } } + private void initMta6Server(String protocol) throws SQLException { + if (isProtocolEnabled(properties, protocol)) { + serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { + @Override + protected void addSpecificHandlers(ChannelPipeline pipeline) { + pipeline.addLast("httpDecoder", new HttpRequestDecoder()); + pipeline.addLast("httpEncoder", new HttpResponseEncoder()); + pipeline.addLast("objectDecoder", new Mta6ProtocolDecoder(ServerManager.this)); + } + }); + } + } + + private void initTeltonikaServer(String protocol) throws SQLException { + if (isProtocolEnabled(properties, protocol)) { + serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { + @Override + protected void addSpecificHandlers(ChannelPipeline pipeline) { + pipeline.addLast("frameDecoder", new TeltonikaFrameDecoder()); + pipeline.addLast("objectDecoder", new TeltonikaProtocolDecoder(ServerManager.this)); + } + }); + } + } + } |