From 2778c38fbaf71727e4cd5cfa5c2a386f8bbf1cfb Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Fri, 17 Aug 2012 15:12:34 +1000 Subject: Add new MaxonProtocolDecoder class --- src/org/traccar/Server.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/org/traccar/Server.java') 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); + } + } + } -- cgit v1.2.3