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