diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-04-27 21:08:40 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-04-27 21:08:40 +1200 |
commit | 4021d2815fb56a75261cfe0cba97f87a63ed9f02 (patch) | |
tree | e3cd995c5c0f0514cb5ef539cfe1cbb9bae024e7 /src/org/traccar/ServerManager.java | |
parent | 43400a93fdbf95c0adf604000f14f30a003ebf96 (diff) | |
download | traccar-server-4021d2815fb56a75261cfe0cba97f87a63ed9f02.tar.gz traccar-server-4021d2815fb56a75261cfe0cba97f87a63ed9f02.tar.bz2 traccar-server-4021d2815fb56a75261cfe0cba97f87a63ed9f02.zip |
Add Wialon protocol
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r-- | src/org/traccar/ServerManager.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 4a6682679..35218eee4 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -35,6 +35,7 @@ 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.frame.LineBasedFrameDecoder; import org.jboss.netty.handler.codec.http.HttpRequestDecoder; import org.jboss.netty.handler.codec.http.HttpResponseEncoder; import org.jboss.netty.handler.codec.string.StringDecoder; @@ -144,6 +145,7 @@ public class ServerManager { initTk102Server("tk102"); initIntellitracServer("intellitrac"); initXt7Server("xt7"); + initWialonServer("wialon"); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -810,5 +812,19 @@ public class ServerManager { }); } } + + private void initWialonServer(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("stringEncoder", new StringEncoder()); + pipeline.addLast("objectDecoder", new WialonProtocolDecoder(ServerManager.this)); + } + }); + } + } } |