diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-08-19 22:03:26 +0400 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-08-19 22:03:26 +0400 |
commit | b0b93983f5411ceffc649d44d55093b04ddf802a (patch) | |
tree | 3d7cd47fa6ce2efe5f7380e5e034c79644aa738f /src/org/traccar/Server.java | |
parent | ce0bc3fe3087e6be439ca874d61b056006001029 (diff) | |
parent | 2778c38fbaf71727e4cd5cfa5c2a386f8bbf1cfb (diff) | |
download | trackermap-server-b0b93983f5411ceffc649d44d55093b04ddf802a.tar.gz trackermap-server-b0b93983f5411ceffc649d44d55093b04ddf802a.tar.bz2 trackermap-server-b0b93983f5411ceffc649d44d55093b04ddf802a.zip |
Merge branch 'arekinath-master'
Diffstat (limited to 'src/org/traccar/Server.java')
-rw-r--r-- | src/org/traccar/Server.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index 184281b84..36d7720b6 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -96,6 +96,7 @@ public class Server { initAvl08Server(properties); initEnforaServer(properties); initMeiligaoServer(properties); + initMaxonServer(properties); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -455,4 +456,26 @@ public class Server { } } + private void initMaxonServer(Properties properties) throws SQLException { + String protocol = "maxon"; + if (isProtocolEnabled(properties, protocol)) { + + TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol)); + final Integer resetDelay = getProtocolResetDelay(properties, protocol); + + server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) { + protected void addSpecificHandlers(ChannelPipeline pipeline) { + byte delimiter[] = { (byte) '\r', (byte) '\n' }; + pipeline.addLast("frameDecoder", + new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); + pipeline.addLast("objectDecoder", new MaxonProtocolDecoder(getDataManager(), resetDelay)); + } + }); + + serverList.add(server); + } + } + } |