aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/ServerManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-08-19 23:25:40 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-08-19 23:25:40 +1200
commitf03fbcc96e804c232a873d63eaf55060685ad3da (patch)
tree2ac84a74564611d4f321a7c81b550c7b0eaa6645 /src/org/traccar/ServerManager.java
parent6ec4bb34e99a56b2786b149d73f243246fb979d9 (diff)
downloadtrackermap-server-f03fbcc96e804c232a873d63eaf55060685ad3da.tar.gz
trackermap-server-f03fbcc96e804c232a873d63eaf55060685ad3da.tar.bz2
trackermap-server-f03fbcc96e804c232a873d63eaf55060685ad3da.zip
Add M2M mini protocol
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r--src/org/traccar/ServerManager.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java
index f5130816f..e478c6f2f 100644
--- a/src/org/traccar/ServerManager.java
+++ b/src/org/traccar/ServerManager.java
@@ -27,6 +27,7 @@ import org.jboss.netty.bootstrap.ServerBootstrap;
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.FixedLengthFrameDecoder;
import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder;
import org.jboss.netty.handler.codec.http.HttpRequestDecoder;
@@ -149,6 +150,7 @@ public class ServerManager {
initTotemServer("totem");
initGatorServer("gator");
initNoranServer("noran");
+ initM2mServer("m2m");
// Initialize web server
if (Boolean.valueOf(properties.getProperty("http.enable"))) {
@@ -968,4 +970,16 @@ public class ServerManager {
}
}
+ private void initM2mServer(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 FixedLengthFrameDecoder(23));
+ pipeline.addLast("objectDecoder", new M2mProtocolDecoder(ServerManager.this));
+ }
+ });
+ }
+ }
+
}