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 | |
parent | 22a8d46522824151f71c53f3fcab5e3b0d72f608 (diff) | |
download | traccar-server-6dc180657196e4b6c2029c8b3fe9d3931152d094.tar.gz traccar-server-6dc180657196e4b6c2029c8b3fe9d3931152d094.tar.bz2 traccar-server-6dc180657196e4b6c2029c8b3fe9d3931152d094.zip |
Add ST-210 server
-rw-r--r-- | default.cfg | 5 | ||||
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | src/org/traccar/Server.java | 22 |
3 files changed, 28 insertions, 1 deletions
diff --git a/default.cfg b/default.cfg index 2568a2cc3..21b59cc0a 100644 --- a/default.cfg +++ b/default.cfg @@ -145,4 +145,9 @@ <entry key="maxon.port">5010</entry> <entry key="maxon.resetDelay">0</entry> + <!-- ST-210 server configuration --> + <entry key="st210.enable">true</entry> + <entry key="st210.port">5011</entry> + <entry key="st210.resetDelay">0</entry> + </properties> @@ -81,7 +81,7 @@ <plugins> <plugin> <artifactId>maven-dependency-plugin</artifactId> - <version>2.4</version> + <version>2.5</version> <executions> <execution> <phase>install</phase> 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); + } + } + } |