diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-04-28 12:59:54 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-04-28 12:59:54 +1200 |
commit | 208312ce478f94c44d9020625edc6cd1a26fa00f (patch) | |
tree | e10dce58590b8da39083ccdcb7061609350aed1e /src/org/traccar/ServerManager.java | |
parent | 4021d2815fb56a75261cfe0cba97f87a63ed9f02 (diff) | |
download | trackermap-server-208312ce478f94c44d9020625edc6cd1a26fa00f.tar.gz trackermap-server-208312ce478f94c44d9020625edc6cd1a26fa00f.tar.bz2 trackermap-server-208312ce478f94c44d9020625edc6cd1a26fa00f.zip |
Add Carscop protocol
Diffstat (limited to 'src/org/traccar/ServerManager.java')
-rw-r--r-- | src/org/traccar/ServerManager.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 35218eee4..914e818e3 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -146,6 +146,7 @@ public class ServerManager { initIntellitracServer("intellitrac"); initXt7Server("xt7"); initWialonServer("wialon"); + initCarscopServer("carscop"); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -827,4 +828,20 @@ public class ServerManager { } } + private void initCarscopServer(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 CarscopProtocolDecoder(ServerManager.this)); + } + }); + } + } + } |