aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/ServerManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-02-03 16:03:07 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-02-03 16:03:07 +1300
commit1c46c37b9a2ebe856b1d4b7e2ddf3cf24526dfb6 (patch)
tree2cadc0fb484a6d52c39688e9f1c41618bb5b715e /src/org/traccar/ServerManager.java
parentff67008d5c9fb78f98c4bf821d0d8f8f064d5b5e (diff)
downloadtrackermap-server-1c46c37b9a2ebe856b1d4b7e2ddf3cf24526dfb6.tar.gz
trackermap-server-1c46c37b9a2ebe856b1d4b7e2ddf3cf24526dfb6.tar.bz2
trackermap-server-1c46c37b9a2ebe856b1d4b7e2ddf3cf24526dfb6.zip
Added Teltonika protocol (fix #14)
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r--src/org/traccar/ServerManager.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java
index ca656af73..85aa8b2cc 100644
--- a/src/org/traccar/ServerManager.java
+++ b/src/org/traccar/ServerManager.java
@@ -35,6 +35,8 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder;
import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
+import org.jboss.netty.handler.codec.http.HttpRequestDecoder;
+import org.jboss.netty.handler.codec.http.HttpResponseEncoder;
import org.jboss.netty.handler.codec.string.StringDecoder;
import org.jboss.netty.handler.codec.string.StringEncoder;
import org.traccar.geocode.GoogleReverseGeocoder;
@@ -129,6 +131,8 @@ public class ServerManager {
initGt06Server("gt06");
initMegastekServer("megastek");
initNavigilServer("navigil");
+ initMta6Server("mta6");
+ initTeltonikaServer("teltonika");
// Initialize web server
if (Boolean.valueOf(properties.getProperty("http.enable"))) {
@@ -606,4 +610,29 @@ public class ServerManager {
}
}
+ private void initMta6Server(String protocol) throws SQLException {
+ if (isProtocolEnabled(properties, protocol)) {
+ serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) {
+ @Override
+ protected void addSpecificHandlers(ChannelPipeline pipeline) {
+ pipeline.addLast("httpDecoder", new HttpRequestDecoder());
+ pipeline.addLast("httpEncoder", new HttpResponseEncoder());
+ pipeline.addLast("objectDecoder", new Mta6ProtocolDecoder(ServerManager.this));
+ }
+ });
+ }
+ }
+
+ private void initTeltonikaServer(String protocol) throws SQLException {
+ if (isProtocolEnabled(properties, protocol)) {
+ serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) {
+ @Override
+ protected void addSpecificHandlers(ChannelPipeline pipeline) {
+ pipeline.addLast("frameDecoder", new TeltonikaFrameDecoder());
+ pipeline.addLast("objectDecoder", new TeltonikaProtocolDecoder(ServerManager.this));
+ }
+ });
+ }
+ }
+
}