diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-04-09 23:38:11 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-04-09 23:38:11 +1200 |
commit | fa19cf45bc885593b9efc63131fbff514336d4cf (patch) | |
tree | 900f9a5692486a3c435ddde8ecedb0ac0d92b2d4 /src/org/traccar/ServerManager.java | |
parent | 6f7493e600316fd672162aa3f2b22b41c2642ebb (diff) | |
download | trackermap-server-fa19cf45bc885593b9efc63131fbff514336d4cf.tar.gz trackermap-server-fa19cf45bc885593b9efc63131fbff514336d4cf.tar.bz2 trackermap-server-fa19cf45bc885593b9efc63131fbff514336d4cf.zip |
Support TK102 protocol
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r-- | src/org/traccar/ServerManager.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 836b1e3ff..94e68b7da 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -141,6 +141,7 @@ public class ServerManager { initCellocatorServer("cellocator"); initGalileoServer("galileo"); initYwtServer("ywt"); + initTk102Server("tk102"); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -763,5 +764,21 @@ public class ServerManager { }); } } - + + private void initTk102Server(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) ']' }; + pipeline.addLast("frameDecoder", + new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); + pipeline.addLast("objectDecoder", new Tk102ProtocolDecoder(ServerManager.this)); + } + }); + } + } + } |