diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-04-20 17:08:58 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-04-20 17:08:58 +1200 |
commit | a0ea4b0461296cd259604a9f5b8ed79e125b88f5 (patch) | |
tree | d27d615f2be846d10f8985267bc8691507d7eb07 /src/org/traccar/ServerManager.java | |
parent | 5d5ba5b00a390cb510e8d547788846ae2bc9fe93 (diff) | |
download | trackermap-server-a0ea4b0461296cd259604a9f5b8ed79e125b88f5.tar.gz trackermap-server-a0ea4b0461296cd259604a9f5b8ed79e125b88f5.tar.bz2 trackermap-server-a0ea4b0461296cd259604a9f5b8ed79e125b88f5.zip |
Implement CarTrack protocol
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r-- | src/org/traccar/ServerManager.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 7558b1f31..43fbec650 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -164,6 +164,7 @@ public class ServerManager { initKhdServer("khd"); initPiligrimServer("piligrim"); initStl060Server("stl060"); + initCarTrackServer("cartrack"); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -1083,4 +1084,19 @@ public class ServerManager { } } + private void initCarTrackServer(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) '#', (byte) '#' }; + pipeline.addLast("frameDecoder", + new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("objectDecoder", new CarTrackProtocolDecoder(ServerManager.this)); + } + }); + } + } + } |