From 8601bea268a973825d9dc3835ccced6439e26a0e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 23 Aug 2013 22:46:45 +1200 Subject: Add EasyTrack protocol (fix #357) --- src/org/traccar/ServerManager.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/org/traccar/ServerManager.java') 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)); + } + }); + } + } + } -- cgit v1.2.3