From 9fe73b049bd739a65b57ec96dec357b0abe42aee Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 15 Jan 2015 13:41:56 +1300 Subject: Move Xexun to 5006 port --- src/org/traccar/ServerManager.java | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 1f1a380e4..1bf2a09b7 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -104,13 +104,12 @@ public class ServerManager { initGeocoder(properties); - initXexunServer("xexun"); initGps103Server("gps103"); initTk103Server("tk103"); initGl100Server("gl100"); initGl200Server("gl200"); initT55Server("t55"); - initXexun2Server("xexun2"); + initXexunServer("xexun"); initTotemServer("totem"); initEnforaServer("enfora"); initMeiligaoServer("meiligao"); @@ -234,19 +233,6 @@ public class ServerManager { return false; } - private void initXexunServer(final String protocol) throws SQLException { - if (isProtocolEnabled(properties, protocol)) { - serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { - @Override - protected void addSpecificHandlers(ChannelPipeline pipeline) { - pipeline.addLast("frameDecoder", new XexunFrameDecoder()); - pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new XexunProtocolDecoder(dataManager, protocol, properties)); - } - }); - } - } - private void initGps103Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @@ -333,14 +319,20 @@ public class ServerManager { } } - private void initXexun2Server(final String protocol) throws SQLException { + private void initXexunServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { - pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); // tracker bug \n\r - pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new Xexun2ProtocolDecoder(dataManager, protocol, properties)); + if (Boolean.valueOf(properties.containsKey(protocol + ".extended"))) { + pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); // tracker bug \n\r + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("objectDecoder", new Xexun2ProtocolDecoder(dataManager, protocol, properties)); + } else { + pipeline.addLast("frameDecoder", new XexunFrameDecoder()); + pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("objectDecoder", new XexunProtocolDecoder(dataManager, protocol, properties)); + } } }); } -- cgit v1.2.3