diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-08-19 22:34:23 +0400 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-08-19 22:34:23 +0400 |
commit | 6dc180657196e4b6c2029c8b3fe9d3931152d094 (patch) | |
tree | 95fcf99b0b9f1d605880c82b78f91158d9bc01c6 /src/org/traccar | |
parent | 22a8d46522824151f71c53f3fcab5e3b0d72f608 (diff) | |
download | trackermap-server-6dc180657196e4b6c2029c8b3fe9d3931152d094.tar.gz trackermap-server-6dc180657196e4b6c2029c8b3fe9d3931152d094.tar.bz2 trackermap-server-6dc180657196e4b6c2029c8b3fe9d3931152d094.zip |
Add ST-210 server
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); + } + } + } |