diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-03-23 12:50:05 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-03-23 12:50:05 +1300 |
commit | a2709e3e9c2615e95139f03aec1c5e734f33f191 (patch) | |
tree | a9b75502065ea7ac9a9a0b79775dcc96b7388523 /src/org/traccar/ServerManager.java | |
parent | ee4f40561f5cce1a9a07576662af69fadb9851ca (diff) | |
download | trackermap-server-a2709e3e9c2615e95139f03aec1c5e734f33f191.tar.gz trackermap-server-a2709e3e9c2615e95139f03aec1c5e734f33f191.tar.bz2 trackermap-server-a2709e3e9c2615e95139f03aec1c5e734f33f191.zip |
Add YWT protocol support
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 59d98af0e..836b1e3ff 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -140,6 +140,7 @@ public class ServerManager { initWondexServer("wondex"); initCellocatorServer("cellocator"); initGalileoServer("galileo"); + initYwtServer("ywt"); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -746,5 +747,21 @@ public class ServerManager { serverList.add(server); } } + + private void initYwtServer(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 YwtProtocolDecoder(ServerManager.this)); + } + }); + } + } } |