aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/ServerManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-01-18 23:02:18 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-01-18 23:02:18 +1300
commit534a0107dccd91556252ca927852476628465a4d (patch)
treed8287a283724a36a076a71e726dca309361058d7 /src/org/traccar/ServerManager.java
parenta01f9f7582cd7a25721be82df578d212fda4b5cc (diff)
downloadtrackermap-server-534a0107dccd91556252ca927852476628465a4d.tar.gz
trackermap-server-534a0107dccd91556252ca927852476628465a4d.tar.bz2
trackermap-server-534a0107dccd91556252ca927852476628465a4d.zip
Add Megatek protocol (fix #112)
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r--src/org/traccar/ServerManager.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java
index 23b067712..2fb9f3f6b 100644
--- a/src/org/traccar/ServerManager.java
+++ b/src/org/traccar/ServerManager.java
@@ -127,6 +127,7 @@ public class ServerManager {
initSkypatrolServer("skypatrol");
initGt02Server("gt02");
initGt06Server("gt06");
+ initMegastekServer("megastek");
// Initialize web server
if (Boolean.valueOf(properties.getProperty("http.enable"))) {
@@ -574,4 +575,20 @@ public class ServerManager {
}
}
+ private void initMegastekServer(String protocol) throws SQLException {
+ if (isProtocolEnabled(properties, protocol)) {
+ serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) {
+ @Override
+ protected void addSpecificHandlers(ChannelPipeline pipeline) {
+ byte delimiter[] = { (byte) '\r', (byte) '\n' };
+ pipeline.addLast("frameDecoder",
+ new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
+ pipeline.addLast("stringDecoder", new StringDecoder());
+ pipeline.addLast("stringEncoder", new StringEncoder());
+ pipeline.addLast("objectDecoder", new MegastekProtocolDecoder(ServerManager.this));
+ }
+ });
+ }
+ }
+
}