diff options
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); + } + } + } |