aboutsummaryrefslogtreecommitdiff
path: root/src/net/sourceforge/opentracking/Server.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2011-05-05 06:28:25 +0000
committerAnton Tananaev <anton.tananaev@gmail.com>2011-05-05 06:28:25 +0000
commitd673fa357b64ffa34209465a535d00983cba5576 (patch)
treebff99c61fdf368a915adb336f1d1b173d99b6197 /src/net/sourceforge/opentracking/Server.java
parentdd6db81db43f5c23e5349c0b06d4a0ce6830d127 (diff)
downloadtrackermap-server-d673fa357b64ffa34209465a535d00983cba5576.tar.gz
trackermap-server-d673fa357b64ffa34209465a535d00983cba5576.tar.bz2
trackermap-server-d673fa357b64ffa34209465a535d00983cba5576.zip
Diffstat (limited to 'src/net/sourceforge/opentracking/Server.java')
-rw-r--r--src/net/sourceforge/opentracking/Server.java39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/net/sourceforge/opentracking/Server.java b/src/net/sourceforge/opentracking/Server.java
index 278a4589a..8769d1d04 100644
--- a/src/net/sourceforge/opentracking/Server.java
+++ b/src/net/sourceforge/opentracking/Server.java
@@ -40,6 +40,7 @@ import org.jboss.netty.handler.logging.LoggingHandler;
import net.sourceforge.opentracking.protocol.xexun.XexunFrameDecoder;
import net.sourceforge.opentracking.protocol.xexun.XexunProtocolDecoder;
import net.sourceforge.opentracking.protocol.gps103.Gps103ProtocolDecoder;
+import net.sourceforge.opentracking.protocol.tk103.Tk103ProtocolDecoder;
/**
* Server
@@ -75,6 +76,7 @@ public class Server implements DataManager {
initXexunServer(properties);
initGps103Server(properties);
+ initTk103Server(properties);
}
/**
@@ -216,7 +218,9 @@ public class Server implements DataManager {
}
server.getPipeline().addLast("frameDecoder", new XexunFrameDecoder());
server.getPipeline().addLast("stringDecoder", new StringDecoder());
- server.getPipeline().addLast("objectDecoder", new XexunProtocolDecoder(this));
+ String resetDelay = properties.getProperty("xexun.resetDelay");
+ server.getPipeline().addLast("objectDecoder", new XexunProtocolDecoder(this,
+ (resetDelay == null) ? 0 : Integer.valueOf(resetDelay)));
server.getPipeline().addLast("handler", new TrackerEventHandler(this));
@@ -243,7 +247,38 @@ public class Server implements DataManager {
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
server.getPipeline().addLast("stringDecoder", new StringDecoder());
server.getPipeline().addLast("stringEncoder", new StringEncoder());
- server.getPipeline().addLast("objectDecoder", new Gps103ProtocolDecoder(this));
+ String resetDelay = properties.getProperty("gps103.resetDelay");
+ server.getPipeline().addLast("objectDecoder", new Gps103ProtocolDecoder(this,
+ (resetDelay == null) ? 0 : Integer.valueOf(resetDelay)));
+
+ server.getPipeline().addLast("handler", new TrackerEventHandler(this));
+
+ serverList.add(server);
+ }
+ }
+
+ /**
+ * Init Tk103 server
+ */
+ public void initTk103Server(Properties properties) throws SQLException {
+
+ boolean enable = Boolean.valueOf(properties.getProperty("tk103.enable"));
+ if (enable) {
+
+ TrackerServer server = new TrackerServer(
+ Integer.valueOf(properties.getProperty("tk103.port")));
+
+ if (loggerEnable) {
+ server.getPipeline().addLast("logger", new LoggingHandler("logger"));
+ }
+ byte delimiter[] = { (byte) ')' };
+ server.getPipeline().addLast("frameDecoder",
+ new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
+ server.getPipeline().addLast("stringDecoder", new StringDecoder());
+ server.getPipeline().addLast("stringEncoder", new StringEncoder());
+ String resetDelay = properties.getProperty("tk103.resetDelay");
+ server.getPipeline().addLast("objectDecoder", new Tk103ProtocolDecoder(this,
+ (resetDelay == null) ? 0 : Integer.valueOf(resetDelay)));
server.getPipeline().addLast("handler", new TrackerEventHandler(this));