diff options
-rw-r--r-- | default.cfg | 11 | ||||
-rw-r--r-- | src/org/traccar/ServerManager.java | 30 |
2 files changed, 15 insertions, 26 deletions
diff --git a/default.cfg b/default.cfg index 7270355cc..7c7de9561 100644 --- a/default.cfg +++ b/default.cfg @@ -68,10 +68,6 @@ <entry key='logger.level'>all</entry> <entry key='logger.file'>/home/user/Documents/traccar/target/tracker-server.log</entry> - <!-- Xexun server configuration --> - <entry key='xexun.enable'>true</entry> - <entry key='xexun.port'>5000</entry> - <!-- Gps103 server configuration --> <entry key='gps103.enable'>true</entry> <entry key='gps103.port'>5001</entry> @@ -92,9 +88,10 @@ <entry key='t55.enable'>true</entry> <entry key='t55.port'>5005</entry> - <!-- Xexun 2 server configuration --> - <entry key='xexun2.enable'>true</entry> - <entry key='xexun2.port'>5006</entry> + <!-- Xexun server configuration --> + <entry key='xexun.enable'>true</entry> + <entry key='xexun.port'>5006</entry> + <entry key='xexun.extended'>false</entry> <!-- Totem server configuration --> <entry key='totem.enable'>true</entry> 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)); + } } }); } |