diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/Server.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index 36d7720b6..7df1a463a 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -97,6 +97,7 @@ public class Server { initEnforaServer(properties); initMeiligaoServer(properties); initMaxonServer(properties); + initST210Server(properties); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -478,4 +479,25 @@ public class Server { } } + private void initST210Server(Properties properties) throws SQLException { + String protocol = "st210"; + 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' }; + pipeline.addLast("frameDecoder", + new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("objectDecoder", new ST210ProtocolDecoder(getDataManager(), resetDelay)); + } + }); + + serverList.add(server); + } + } + } |