diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-08-23 22:46:45 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-08-23 22:46:45 +1200 |
commit | 8601bea268a973825d9dc3835ccced6439e26a0e (patch) | |
tree | 2420c9cd0daaa2d263f6cc3f71486e90122cddd5 /src/org/traccar/ServerManager.java | |
parent | 63d1859cde9c8f3fb9bc85e0c202750bda8d975e (diff) | |
download | traccar-server-8601bea268a973825d9dc3835ccced6439e26a0e.tar.gz traccar-server-8601bea268a973825d9dc3835ccced6439e26a0e.tar.bz2 traccar-server-8601bea268a973825d9dc3835ccced6439e26a0e.zip |
Add EasyTrack protocol (fix #357)
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 6216da225..46346f1c1 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -157,6 +157,7 @@ public class ServerManager { initNoranServer("noran"); initM2mServer("m2m"); initOsmAndServer("osmand"); + initEasyTrackServer("easytrack"); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -998,4 +999,19 @@ public class ServerManager { } } + private void initEasyTrackServer(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("objectDecoder", new EasyTrackProtocolDecoder(ServerManager.this)); + } + }); + } + } + } |