diff options
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r-- | src/org/traccar/ServerManager.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 1c4673f7a..56647aecd 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -168,6 +168,8 @@ public class ServerManager { initMiniFinderServer("minifinder"); initHaicomServer("haicom"); initEelinkServer("eelink"); + initBoxServer("box"); + initFreedomServer("freedom"); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -1143,4 +1145,32 @@ public class ServerManager { } } + private void initBoxServer(String protocol) throws SQLException { + if (isProtocolEnabled(properties, protocol)) { + serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { + @Override + protected void addSpecificHandlers(ChannelPipeline pipeline) { + byte delimiter[] = { (byte) '\r' }; + pipeline.addLast("frameDecoder", + new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("objectDecoder", new BoxProtocolDecoder(ServerManager.this)); + } + }); + } + } + + private void initFreedomServer(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 LineBasedFrameDecoder(1024)); + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("objectDecoder", new FreedomProtocolDecoder(ServerManager.this)); + } + }); + } + } + } |