diff options
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r-- | src/org/traccar/ServerManager.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index f5130816f..e478c6f2f 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -27,6 +27,7 @@ import org.jboss.netty.bootstrap.ServerBootstrap; 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.FixedLengthFrameDecoder; import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder; import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder; import org.jboss.netty.handler.codec.http.HttpRequestDecoder; @@ -149,6 +150,7 @@ public class ServerManager { initTotemServer("totem"); initGatorServer("gator"); initNoranServer("noran"); + initM2mServer("m2m"); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -968,4 +970,16 @@ public class ServerManager { } } + private void initM2mServer(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 FixedLengthFrameDecoder(23)); + pipeline.addLast("objectDecoder", new M2mProtocolDecoder(ServerManager.this)); + } + }); + } + } + } |