diff options
author | Alex Wilson <alex@uq.edu.au> | 2012-08-17 15:12:34 +1000 |
---|---|---|
committer | Alex Wilson <alex@uq.edu.au> | 2012-08-17 15:12:34 +1000 |
commit | 2778c38fbaf71727e4cd5cfa5c2a386f8bbf1cfb (patch) | |
tree | 3d7cd47fa6ce2efe5f7380e5e034c79644aa738f /src/org/traccar/Server.java | |
parent | ce0bc3fe3087e6be439ca874d61b056006001029 (diff) | |
download | trackermap-server-2778c38fbaf71727e4cd5cfa5c2a386f8bbf1cfb.tar.gz trackermap-server-2778c38fbaf71727e4cd5cfa5c2a386f8bbf1cfb.tar.bz2 trackermap-server-2778c38fbaf71727e4cd5cfa5c2a386f8bbf1cfb.zip |
Add new MaxonProtocolDecoder class
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); + } + } + } |