diff options
Diffstat (limited to 'src')
72 files changed, 681 insertions, 476 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java index e23367278..04b1a1eec 100644 --- a/src/org/traccar/BaseProtocolDecoder.java +++ b/src/org/traccar/BaseProtocolDecoder.java @@ -16,12 +16,15 @@ package org.traccar; import java.net.SocketAddress; +import java.util.Properties; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelEvent; import org.jboss.netty.channel.ChannelHandlerContext; import static org.jboss.netty.channel.Channels.fireMessageReceived; import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.handler.codec.oneone.OneToOneDecoder; + import org.traccar.database.DataManager; /** @@ -29,33 +32,27 @@ import org.traccar.database.DataManager; */ public abstract class BaseProtocolDecoder extends OneToOneDecoder { - private ServerManager serverManager; - private DataManager dataManager; - - public final void setDataManager(DataManager dataManager) { - this.dataManager = dataManager; - } + private final DataManager dataManager; + private final String protocol; + private final Properties properties; public final DataManager getDataManager() { return dataManager; } - public final void setServerManager(ServerManager serverManager) { - this.serverManager = serverManager; - } - - public final ServerManager getServerManager() { - return serverManager; + public final String getProtocol() { + return protocol; } - - public BaseProtocolDecoder() { + + public final Properties getProperties() { + return properties; } - public BaseProtocolDecoder(ServerManager serverManager) { - if (serverManager != null) { - this.serverManager = serverManager; - dataManager = serverManager.getDataManager(); - } + + public BaseProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + this.dataManager = dataManager; + this.protocol = protocol; + this.properties = properties; } @Override diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 33d364cc4..f50e66fc5 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -22,6 +22,7 @@ import java.sql.SQLException; import java.util.LinkedList; import java.util.List; import java.util.Properties; + import org.jboss.netty.bootstrap.ConnectionlessBootstrap; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.buffer.ChannelBuffers; @@ -35,6 +36,7 @@ import org.jboss.netty.handler.codec.http.HttpRequestDecoder; import org.jboss.netty.handler.codec.http.HttpResponseEncoder; import org.jboss.netty.handler.codec.string.StringDecoder; import org.jboss.netty.handler.codec.string.StringEncoder; + import org.traccar.geocode.GoogleReverseGeocoder; import org.traccar.geocode.NominatimReverseGeocoder; import org.traccar.geocode.ReverseGeocoder; @@ -228,20 +230,20 @@ public class ServerManager { return false; } - private void initXexunServer(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 XexunFrameDecoder()); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new XexunProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new XexunProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initGps103Server(String protocol) throws SQLException { + private void initGps103Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -255,7 +257,7 @@ public class ServerManager { ChannelBuffers.wrappedBuffer(delimiter3))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new Gps103ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Gps103ProtocolDecoder(dataManager, protocol, properties)); } }); serverList.add(new TrackerServer(this, new ConnectionlessBootstrap(), protocol) { @@ -263,13 +265,13 @@ public class ServerManager { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new Gps103ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Gps103ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initTk103Server(String protocol) throws SQLException { + private void initTk103Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -279,7 +281,7 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new Tk103ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Tk103ProtocolDecoder(dataManager, protocol, properties)); } }); serverList.add(new TrackerServer(this, new ConnectionlessBootstrap(), protocol) { @@ -287,13 +289,13 @@ public class ServerManager { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new Tk103ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Tk103ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initGl100Server(String protocol) throws SQLException { + private void initGl100Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -303,13 +305,13 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new Gl100ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Gl100ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initGl200Server(String protocol) throws SQLException { + private void initGl200Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -322,13 +324,13 @@ public class ServerManager { ChannelBuffers.wrappedBuffer(delimiter2))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new Gl200ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Gl200ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initT55Server(String protocol) throws SQLException { + private void initT55Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -338,13 +340,13 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new T55ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new T55ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initXexun2Server(String protocol) throws SQLException { + private void initXexun2Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -353,50 +355,50 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new Xexun2ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Xexun2ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initTotemServer(String protocol) throws SQLException { + private void initTotemServer(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 TotemFrameDecoder()); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new TotemProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new TotemProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initEnforaServer(String protocol) throws SQLException { + private void initEnforaServer(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 LengthFieldBasedFrameDecoder(1024, 0, 2, -2, 2)); - pipeline.addLast("objectDecoder", new EnforaProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new EnforaProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initMeiligaoServer(String protocol) throws SQLException { + private void initMeiligaoServer(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 MeiligaoFrameDecoder()); - pipeline.addLast("objectDecoder", new MeiligaoProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new MeiligaoProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initMaxonServer(String protocol) throws SQLException { + private void initMaxonServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -406,13 +408,13 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new MaxonProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new MaxonProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initSuntechServer(String protocol) throws SQLException { + private void initSuntechServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -421,19 +423,19 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new SuntechProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new SuntechProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initProgressServer(String protocol) throws SQLException { + private void initProgressServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, 4, 0)); - pipeline.addLast("objectDecoder", new ProgressProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new ProgressProtocolDecoder(dataManager, protocol, properties)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); @@ -441,31 +443,31 @@ public class ServerManager { } } - private void initH02Server(String protocol) throws SQLException { + private void initH02Server(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 H02FrameDecoder()); - pipeline.addLast("objectDecoder", new H02ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new H02ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initJt600Server(String protocol) throws SQLException { + private void initJt600Server(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 Jt600FrameDecoder()); - pipeline.addLast("objectDecoder", new Jt600ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Jt600ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initEv603Server(String protocol) throws SQLException { + private void initEv603Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -474,13 +476,13 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new Ev603ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Ev603ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initV680Server(String protocol) throws SQLException { + private void initV680Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -489,20 +491,20 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new V680ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new V680ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initPt502Server(String protocol) throws SQLException { + private void initPt502Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new Pt502FrameDecoder()); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new Pt502ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Pt502ProtocolDecoder(dataManager, protocol, properties)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); @@ -510,7 +512,7 @@ public class ServerManager { } } - private void initTr20Server(String protocol) throws SQLException { + private void initTr20Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -520,19 +522,19 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new Tr20ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Tr20ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initNavisServer(String protocol) throws SQLException { + private void initNavisServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(4 * 1024, 12, 2, 2, 0)); - pipeline.addLast("objectDecoder", new NavisProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new NavisProtocolDecoder(dataManager, protocol, properties)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); @@ -540,14 +542,14 @@ public class ServerManager { } } - private void initMeitrackServer(String protocol) throws SQLException { + private void initMeitrackServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new MeitrackFrameDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(dataManager, protocol, properties)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); @@ -555,42 +557,42 @@ public class ServerManager { } } - private void initSkypatrolServer(String protocol) throws SQLException { + private void initSkypatrolServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ConnectionlessBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { - pipeline.addLast("objectDecoder", new SkypatrolProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new SkypatrolProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initGt02Server(String protocol) throws SQLException { + private void initGt02Server(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 LengthFieldBasedFrameDecoder(256, 2, 1, 2, 0)); - pipeline.addLast("objectDecoder", new Gt02ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Gt02ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initGt06Server(String protocol) throws SQLException { + private void initGt06Server(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 Gt06FrameDecoder()); - pipeline.addLast("objectDecoder", new Gt06ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Gt06ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initMegastekServer(String protocol) throws SQLException { + private void initMegastekServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -598,19 +600,19 @@ public class ServerManager { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new MegastekProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new MegastekProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initNavigilServer(String protocol) throws SQLException { + private void initNavigilServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new NavigilFrameDecoder()); - pipeline.addLast("objectDecoder", new NavigilProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new NavigilProtocolDecoder(dataManager, protocol, properties)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); @@ -618,7 +620,7 @@ public class ServerManager { } } - private void initGpsGateServer(String protocol) throws SQLException { + private void initGpsGateServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -628,51 +630,51 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new GpsGateProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new GpsGateProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initTeltonikaServer(String protocol) throws SQLException { + private void initTeltonikaServer(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 TeltonikaFrameDecoder()); - pipeline.addLast("objectDecoder", new TeltonikaProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new TeltonikaProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initMta6Server(String protocol) throws SQLException { + private void initMta6Server(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("httpDecoder", new HttpRequestDecoder()); pipeline.addLast("httpEncoder", new HttpResponseEncoder()); - pipeline.addLast("objectDecoder", new Mta6ProtocolDecoder(ServerManager.this, false)); + pipeline.addLast("objectDecoder", new Mta6ProtocolDecoder(dataManager, protocol, properties, false)); } }); } } - private void initMta6CanServer(String protocol) throws SQLException { + private void initMta6CanServer(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("httpDecoder", new HttpRequestDecoder()); pipeline.addLast("httpEncoder", new HttpResponseEncoder()); - pipeline.addLast("objectDecoder", new Mta6ProtocolDecoder(ServerManager.this, true)); + pipeline.addLast("objectDecoder", new Mta6ProtocolDecoder(dataManager, protocol, properties, true)); } }); } } - private void initTlt2hServer(String protocol) throws SQLException { + private void initTlt2hServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -682,13 +684,13 @@ public class ServerManager { new DelimiterBasedFrameDecoder(32 * 1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new Tlt2hProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Tlt2hProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initSyrusServer(String protocol) throws SQLException { + private void initSyrusServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -698,32 +700,32 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new SyrusProtocolDecoder(ServerManager.this, true)); + pipeline.addLast("objectDecoder", new SyrusProtocolDecoder(dataManager, protocol, properties, true)); } }); } } - private void initWondexServer(String protocol) throws SQLException { + private void initWondexServer(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 WondexFrameDecoder()); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new WondexProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new WondexProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initCellocatorServer(String protocol) throws SQLException { + private void initCellocatorServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CellocatorFrameDecoder()); - pipeline.addLast("objectDecoder", new CellocatorProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new CellocatorProtocolDecoder(dataManager, protocol, properties)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); @@ -731,13 +733,13 @@ public class ServerManager { } } - private void initGalileoServer(String protocol) throws SQLException { + private void initGalileoServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new GalileoFrameDecoder()); - pipeline.addLast("objectDecoder", new GalileoProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new GalileoProtocolDecoder(dataManager, protocol, properties)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); @@ -745,7 +747,7 @@ public class ServerManager { } } - private void initYwtServer(String protocol) throws SQLException { + private void initYwtServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -755,13 +757,13 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new YwtProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new YwtProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initTk102Server(String protocol) throws SQLException { + private void initTk102Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -771,13 +773,13 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new Tk102ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Tk102ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initIntellitracServer(String protocol) throws SQLException { + private void initIntellitracServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -785,25 +787,25 @@ public class ServerManager { pipeline.addLast("frameDecoder", new IntellitracFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new IntellitracProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new IntellitracProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initXt7Server(String protocol) throws SQLException { + private void initXt7Server(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 LengthFieldBasedFrameDecoder(256, 20, 1, 5, 0)); - pipeline.addLast("objectDecoder", new Xt7ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Xt7ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initWialonServer(String protocol) throws SQLException { + private void initWialonServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -811,13 +813,13 @@ public class ServerManager { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new WialonProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new WialonProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initCarscopServer(String protocol) throws SQLException { + private void initCarscopServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -827,19 +829,19 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new CarscopProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new CarscopProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initApelServer(String protocol) throws SQLException { + private void initApelServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, 4, 0)); - pipeline.addLast("objectDecoder", new ApelProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new ApelProtocolDecoder(dataManager, protocol, properties)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); @@ -847,7 +849,7 @@ public class ServerManager { } } - private void initManPowerServer(String protocol) throws SQLException { + private void initManPowerServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -857,13 +859,13 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new ManPowerProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new ManPowerProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initGlobalSatServer(String protocol) throws SQLException { + private void initGlobalSatServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -873,25 +875,25 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new GlobalSatProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new GlobalSatProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initAtrackServer(String protocol) throws SQLException { + private void initAtrackServer(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 AtrackFrameDecoder()); - pipeline.addLast("objectDecoder", new AtrackProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new AtrackProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initPt3000Server(String protocol) throws SQLException { + private void initPt3000Server(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -901,25 +903,25 @@ public class ServerManager { new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new Pt3000ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Pt3000ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initRuptelaServer(String protocol) throws SQLException { + private void initRuptelaServer(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 LengthFieldBasedFrameDecoder(1024, 0, 2, 2, 0)); - pipeline.addLast("objectDecoder", new RuptelaProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new RuptelaProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initTopflytechServer(String protocol) throws SQLException { + private void initTopflytechServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -928,13 +930,13 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new TopflytechProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new TopflytechProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initLaipacServer(String protocol) throws SQLException { + private void initLaipacServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -942,25 +944,25 @@ public class ServerManager { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new LaipacProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new LaipacProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initAplicomServer(String protocol) throws SQLException { + private void initAplicomServer(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 AplicomFrameDecoder()); - pipeline.addLast("objectDecoder", new AplicomProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new AplicomProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initGotopServer(String protocol) throws SQLException { + private void initGotopServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -969,13 +971,13 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new GotopProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new GotopProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initSanavServer(String protocol) throws SQLException { + private void initSanavServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -984,29 +986,29 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new SanavProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new SanavProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initGatorServer(String protocol) throws SQLException { + private void initGatorServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ConnectionlessBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { - pipeline.addLast("objectDecoder", new GatorProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new GatorProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initNoranServer(String protocol) throws SQLException { + private void initNoranServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ConnectionlessBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { - pipeline.addLast("objectDecoder", new NoranProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new NoranProtocolDecoder(dataManager, protocol, properties)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); @@ -1014,32 +1016,32 @@ public class ServerManager { } } - private void initM2mServer(String protocol) throws SQLException { + private void initM2mServer(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 FixedLengthFrameDecoder(23)); - pipeline.addLast("objectDecoder", new M2mProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new M2mProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initOsmAndServer(String protocol) throws SQLException { + private void initOsmAndServer(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("httpDecoder", new HttpRequestDecoder()); pipeline.addLast("httpEncoder", new HttpResponseEncoder()); - pipeline.addLast("objectDecoder", new OsmAndProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new OsmAndProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initEasyTrackServer(String protocol) throws SQLException { + private void initEasyTrackServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -1048,37 +1050,37 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new EasyTrackProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new EasyTrackProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initTaipServer(String protocol) throws SQLException { + private void initTaipServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ConnectionlessBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new SyrusProtocolDecoder(ServerManager.this, false)); + pipeline.addLast("objectDecoder", new SyrusProtocolDecoder(dataManager, protocol, properties, false)); } }); } } - private void initKhdServer(String protocol) throws SQLException { + private void initKhdServer(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 LengthFieldBasedFrameDecoder(256, 3, 2)); - pipeline.addLast("objectDecoder", new KhdProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new KhdProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initPiligrimServer(String protocol) throws SQLException { + private void initPiligrimServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -1086,26 +1088,26 @@ public class ServerManager { pipeline.addLast("httpDecoder", new HttpRequestDecoder()); pipeline.addLast("httpAggregator", new HttpChunkAggregator(16384)); pipeline.addLast("httpEncoder", new HttpResponseEncoder()); - pipeline.addLast("objectDecoder", new PiligrimProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new PiligrimProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initStl060Server(String protocol) throws SQLException { + private void initStl060Server(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 Stl060FrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new Stl060ProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new Stl060ProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initCarTrackServer(String protocol) throws SQLException { + private void initCarTrackServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -1114,13 +1116,13 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new CarTrackProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new CarTrackProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initMiniFinderServer(String protocol) throws SQLException { + private void initMiniFinderServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -1129,13 +1131,13 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new MiniFinderProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new MiniFinderProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initHaicomServer(String protocol) throws SQLException { + private void initHaicomServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -1144,25 +1146,25 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new HaicomProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new HaicomProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initEelinkServer(String protocol) throws SQLException { + private void initEelinkServer(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 LengthFieldBasedFrameDecoder(1024, 3, 2)); - pipeline.addLast("objectDecoder", new EelinkProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new EelinkProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initBoxServer(String protocol) throws SQLException { + private void initBoxServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -1171,26 +1173,26 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new BoxProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new BoxProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initFreedomServer(String protocol) throws SQLException { + private void initFreedomServer(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)); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new FreedomProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new FreedomProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initTelikServer(String protocol) throws SQLException { + private void initTelikServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -1199,13 +1201,13 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new TelikProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new TelikProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initTrackboxServer(String protocol) throws SQLException { + private void initTrackboxServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -1213,13 +1215,13 @@ public class ServerManager { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); pipeline.addLast("stringEncoder", new StringEncoder()); - pipeline.addLast("objectDecoder", new TrackboxProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new TrackboxProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initVisiontekServer(String protocol) throws SQLException { + private void initVisiontekServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { serverList.add(new TrackerServer(this, new ServerBootstrap(), protocol) { @Override @@ -1228,19 +1230,19 @@ public class ServerManager { pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter))); pipeline.addLast("stringDecoder", new StringDecoder()); - pipeline.addLast("objectDecoder", new VisiontekProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new VisiontekProtocolDecoder(dataManager, protocol, properties)); } }); } } - private void initOrionServer(String protocol) throws SQLException { + private void initOrionServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new OrionFrameDecoder()); - pipeline.addLast("objectDecoder", new OrionProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new OrionProtocolDecoder(dataManager, protocol, properties)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); @@ -1248,13 +1250,13 @@ public class ServerManager { } } - private void initRitiServer(String protocol) throws SQLException { + private void initRitiServer(final String protocol) throws SQLException { if (isProtocolEnabled(properties, protocol)) { TrackerServer server = new TrackerServer(this, new ServerBootstrap(), protocol) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 105, 2, 3, 0)); - pipeline.addLast("objectDecoder", new RitiProtocolDecoder(ServerManager.this)); + pipeline.addLast("objectDecoder", new RitiProtocolDecoder(dataManager, protocol, properties)); } }; server.setEndianness(ByteOrder.LITTLE_ENDIAN); diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java index 54b112b59..c772ce6f7 100644 --- a/src/org/traccar/protocol/ApelProtocolDecoder.java +++ b/src/org/traccar/protocol/ApelProtocolDecoder.java @@ -20,13 +20,16 @@ import java.nio.charset.Charset; import java.util.Calendar; import java.util.LinkedList; import java.util.List; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Crc; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -38,8 +41,8 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder { private long lastIndex; private long newIndex; - public ApelProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public ApelProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } /* @@ -165,7 +168,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder { for (int j = 0; j < recordCount; j++) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("apel"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); // Message index diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 21a3127d1..c47731759 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -16,19 +16,22 @@ package org.traccar.protocol; import java.util.Date; +import java.util.Properties; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class AplicomProtocolDecoder extends BaseProtocolDecoder { - public AplicomProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public AplicomProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final long IMEI_BASE_TC65_V20 = 0x1437207000000L; @@ -124,7 +127,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("aplicom"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); try { position.setDeviceId(getDataManager().getDeviceByImei(imei).getId()); } catch(Exception error) { diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index 3dbd214d9..db6cdb7e1 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -19,20 +19,23 @@ import java.nio.charset.Charset; import java.util.Date; import java.util.LinkedList; import java.util.List; +import java.util.Properties; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class AtrackProtocolDecoder extends BaseProtocolDecoder { - public AtrackProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public AtrackProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final int MSG_HEARTBEAT = 0x1A; @@ -96,7 +99,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); position.setDeviceId(deviceId); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("atrack"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); // Date and time position.setTime(new Date(buf.readUnsignedInt() * 1000)); // gps time diff --git a/src/org/traccar/protocol/BoxProtocolDecoder.java b/src/org/traccar/protocol/BoxProtocolDecoder.java index 239b0aac5..cdbd3932e 100644 --- a/src/org/traccar/protocol/BoxProtocolDecoder.java +++ b/src/org/traccar/protocol/BoxProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -31,8 +34,8 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder { private Long deviceId; - public BoxProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public BoxProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -79,7 +82,7 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); position.setDeviceId(deviceId); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("box"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/CarTrackProtocolDecoder.java b/src/org/traccar/protocol/CarTrackProtocolDecoder.java index 559a5ccc1..170db3130 100644 --- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java +++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java @@ -17,21 +17,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class CarTrackProtocolDecoder extends BaseProtocolDecoder { - public CarTrackProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public CarTrackProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -70,7 +73,7 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("cartrack"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; // Get device by unique identifier diff --git a/src/org/traccar/protocol/CarscopProtocolDecoder.java b/src/org/traccar/protocol/CarscopProtocolDecoder.java index 9748b2e09..e56036d0b 100644 --- a/src/org/traccar/protocol/CarscopProtocolDecoder.java +++ b/src/org/traccar/protocol/CarscopProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -31,8 +34,8 @@ public class CarscopProtocolDecoder extends BaseProtocolDecoder { private Long deviceId; - public CarscopProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public CarscopProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } // Very similar to TK103 protocol @@ -80,7 +83,7 @@ public class CarscopProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); position.setDeviceId(deviceId); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("carscop"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); index = 1; // Time diff --git a/src/org/traccar/protocol/CellocatorProtocolDecoder.java b/src/org/traccar/protocol/CellocatorProtocolDecoder.java index 7e55a6865..59350da22 100644 --- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java +++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java @@ -17,21 +17,24 @@ package org.traccar.protocol; import java.nio.ByteOrder; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class CellocatorProtocolDecoder extends BaseProtocolDecoder { - public CellocatorProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public CellocatorProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private String readImei(ChannelBuffer buf) { @@ -103,7 +106,7 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder { // Parse location if (type == MSG_CLIENT_STATUS) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("cellocator"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); // Device identifier try { diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java index 4b0080267..bbf1ce817 100644 --- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java +++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class EasyTrackProtocolDecoder extends BaseProtocolDecoder { - public EasyTrackProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public EasyTrackProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } //ET,358155100003016,HB,A,0d081e,07381e,8038ee09,03d2e9be,004f,0000,40c00000,0f,100,0000,00037c,29 @@ -74,7 +77,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("easytrack"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java index 00c74f7f3..009baebd0 100644 --- a/src/org/traccar/protocol/EelinkProtocolDecoder.java +++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java @@ -17,13 +17,16 @@ package org.traccar.protocol; import java.util.Calendar; import java.util.Date; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Crc; import org.traccar.helper.Log; @@ -32,8 +35,8 @@ import org.traccar.model.Position; public class EelinkProtocolDecoder extends BaseProtocolDecoder { - public EelinkProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public EelinkProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private String readImei(ChannelBuffer buf) { @@ -105,7 +108,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder { Position position = new Position(); position.setDeviceId(deviceId); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("eelink"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); extendedInfo.set("index", index); // Location diff --git a/src/org/traccar/protocol/EnforaProtocolDecoder.java b/src/org/traccar/protocol/EnforaProtocolDecoder.java index eec724e30..8f5391fd6 100644 --- a/src/org/traccar/protocol/EnforaProtocolDecoder.java +++ b/src/org/traccar/protocol/EnforaProtocolDecoder.java @@ -17,14 +17,17 @@ package org.traccar.protocol; import java.nio.charset.Charset; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -32,8 +35,8 @@ import org.traccar.model.Position; public class EnforaProtocolDecoder extends BaseProtocolDecoder { - public EnforaProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public EnforaProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -94,7 +97,7 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("enfora"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; // Get device by IMEI diff --git a/src/org/traccar/protocol/Ev603ProtocolDecoder.java b/src/org/traccar/protocol/Ev603ProtocolDecoder.java index a57a0e79b..7c596d479 100644 --- a/src/org/traccar/protocol/Ev603ProtocolDecoder.java +++ b/src/org/traccar/protocol/Ev603ProtocolDecoder.java @@ -17,13 +17,16 @@ package org.traccar.protocol;
import java.util.Calendar;
+import java.util.Properties;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
+
import org.traccar.BaseProtocolDecoder;
-import org.traccar.ServerManager;
+import org.traccar.database.DataManager;
import org.traccar.helper.Log;
import org.traccar.model.ExtendedInfoFormatter;
import org.traccar.model.Position;
@@ -32,8 +35,8 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder{ private Long deviceId;
- public Ev603ProtocolDecoder(ServerManager serverManager) {
- super(serverManager);
+ public Ev603ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) {
+ super(dataManager, protocol, properties);
}
private static final Pattern pattern = Pattern.compile(
@@ -74,7 +77,7 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder{ // Create new position
Position position = new Position();
position.setDeviceId(deviceId);
- ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("ev603");
+ ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
Integer index = 1;
// Date
diff --git a/src/org/traccar/protocol/FreedomProtocolDecoder.java b/src/org/traccar/protocol/FreedomProtocolDecoder.java index 7e86d285f..21e6f9abc 100644 --- a/src/org/traccar/protocol/FreedomProtocolDecoder.java +++ b/src/org/traccar/protocol/FreedomProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class FreedomProtocolDecoder extends BaseProtocolDecoder { - public FreedomProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public FreedomProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -56,7 +59,7 @@ public class FreedomProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("freedom"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; // Identification diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java index 079b76ea4..dc22c33cd 100644 --- a/src/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java @@ -23,21 +23,24 @@ import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.Set; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class GalileoProtocolDecoder extends BaseProtocolDecoder { - public GalileoProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public GalileoProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final int TAG_IMEI = 0x03; @@ -97,7 +100,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { List<Position> positions = new LinkedList<Position>(); Set<Integer> tags = new HashSet<Integer>(); Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("galileo"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); while (buf.readerIndex() < length) { @@ -108,7 +111,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { positions.add(position); tags.clear(); position = new Position(); - extendedInfo = new ExtendedInfoFormatter("galileo"); + extendedInfo = new ExtendedInfoFormatter(getProtocol()); } tags.add(tag); diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java index 15a46d375..9fb74dacc 100644 --- a/src/org/traccar/protocol/GatorProtocolDecoder.java +++ b/src/org/traccar/protocol/GatorProtocolDecoder.java @@ -16,12 +16,15 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -29,8 +32,8 @@ import org.traccar.model.Position; public class GatorProtocolDecoder extends BaseProtocolDecoder { - public GatorProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public GatorProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final int PACKET_HEARTBEAT = 0x21; @@ -66,7 +69,7 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gator"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); // Identification try { diff --git a/src/org/traccar/protocol/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java index 572615053..fb1e42cce 100644 --- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Gl100ProtocolDecoder extends BaseProtocolDecoder { - public Gl100ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Gl100ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -74,7 +77,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gl100"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 942d6ef10..f8f32effd 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Gl200ProtocolDecoder extends BaseProtocolDecoder { - public Gl200ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Gl200ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -67,7 +70,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gl200"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java index 5b4dc5e9b..5e86c1ce3 100644 --- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java +++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java @@ -20,32 +20,31 @@ import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { - private String format0; - private String format1; + // Default values + private String format0 = "TSPRXAB27GHKLMnaicz*U!"; + private String format1 = "SARY*U!"; - public GlobalSatProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public GlobalSatProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); - // Initialize format strings - format0 = "TSPRXAB27GHKLMnaicz*U!"; - format1 = "SARY*U!"; - if (getServerManager() != null) { - Properties p = getServerManager().getProperties(); - if (p.containsKey("globalsat.format0")) { - format0 = p.getProperty("globalsat.format0"); + if (properties != null) { + if (properties.containsKey(protocol + ".format0")) { + format0 = properties.getProperty(protocol + ".format0"); } - if (p.containsKey("globalsat.format1")) { - format1 = p.getProperty("globalsat.format1"); + if (properties.containsKey(protocol + ".format1")) { + format1 = properties.getProperty(protocol + ".format1"); } } } @@ -83,7 +82,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { // Parse data Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("globalsat"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); for (int formatIndex = 0, valueIndex = 1; formatIndex < format.length() && valueIndex < values.length; formatIndex++) { String value = values[valueIndex]; @@ -204,7 +203,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("globalsat"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; // Identification diff --git a/src/org/traccar/protocol/GotopProtocolDecoder.java b/src/org/traccar/protocol/GotopProtocolDecoder.java index 826faf531..2e49a5dd0 100644 --- a/src/org/traccar/protocol/GotopProtocolDecoder.java +++ b/src/org/traccar/protocol/GotopProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class GotopProtocolDecoder extends BaseProtocolDecoder { - public GotopProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public GotopProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -60,7 +63,7 @@ public class GotopProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gotop"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; // Get device by IMEI diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 124df4377..5ff74e1f1 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -17,21 +17,24 @@ package org.traccar.protocol; import java.net.SocketAddress; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Gps103ProtocolDecoder extends BaseProtocolDecoder { - public Gps103ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Gps103ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -88,7 +91,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gps103"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/org/traccar/protocol/GpsGateProtocolDecoder.java index 268f9ea8a..80e06c911 100644 --- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java +++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Crc; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -32,8 +35,8 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder { private Long deviceId; - public GpsGateProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public GpsGateProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } /** @@ -104,7 +107,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gpsgate"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); Integer index = 1; diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java index 561377f7f..546f7dc56 100644 --- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Gt02ProtocolDecoder extends BaseProtocolDecoder { - public Gt02ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Gt02ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private String readImei(ChannelBuffer buf) { @@ -77,7 +80,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gt02"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); extendedInfo.set("index", index); // Get device id diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index 44702924c..0ef242b05 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -17,13 +17,16 @@ package org.traccar.protocol; import java.util.Calendar; import java.util.Properties; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Crc; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -34,14 +37,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { private Long deviceId; private final TimeZone timeZone = TimeZone.getTimeZone("UTC"); - public Gt06ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Gt06ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); - if (serverManager != null) { - Properties p = getServerManager().getProperties(); - if (p.containsKey("gt06.timezone")) { + if (properties != null) { + if (properties.containsKey(protocol + ".timezone")) { timeZone.setRawOffset( - Integer.valueOf(p.getProperty("gt06.timezone")) * 1000); + Integer.valueOf(properties.getProperty(protocol + ".timezone")) * 1000); } } } @@ -144,7 +146,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); position.setDeviceId(deviceId); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("gt06"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); // Date and time Calendar time = Calendar.getInstance(timeZone); diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index 51b1aff5e..c67eb6053 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -17,14 +17,17 @@ package org.traccar.protocol; import java.nio.charset.Charset; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -32,8 +35,8 @@ import org.traccar.model.Position; public class H02ProtocolDecoder extends BaseProtocolDecoder { - public H02ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public H02ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static double readCoordinate(ChannelBuffer buf, boolean lon) { @@ -59,7 +62,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("h02"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); buf.readByte(); // marker @@ -133,7 +136,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("h02"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java index 1845dc31b..ff7445451 100644 --- a/src/org/traccar/protocol/HaicomProtocolDecoder.java +++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class HaicomProtocolDecoder extends BaseProtocolDecoder { - public HaicomProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public HaicomProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -67,7 +70,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("haicom"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java index 53e67af3d..fa1837e50 100644 --- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java +++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class IntellitracProtocolDecoder extends BaseProtocolDecoder { - public IntellitracProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public IntellitracProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -76,7 +79,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("intellitrac"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; // Detect device diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index b8273b5a4..197b4103a 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -17,14 +17,17 @@ package org.traccar.protocol; import java.nio.charset.Charset; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -32,14 +35,14 @@ import org.traccar.model.Position; public class Jt600ProtocolDecoder extends BaseProtocolDecoder { - public Jt600ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Jt600ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private Position decodeNormalMessage(ChannelBuffer buf) throws Exception { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("jt600"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); buf.readByte(); // header @@ -158,7 +161,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("jt600"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); extendedInfo.set("alert", "true"); Integer index = 1; diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java index bd21592e1..022def9eb 100644 --- a/src/org/traccar/protocol/KhdProtocolDecoder.java +++ b/src/org/traccar/protocol/KhdProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Crc; import org.traccar.helper.Log; @@ -31,8 +34,8 @@ import org.traccar.model.Position; public class KhdProtocolDecoder extends BaseProtocolDecoder { - public KhdProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public KhdProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private String readSerialNumber(ChannelBuffer buf) { @@ -73,7 +76,7 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("khd"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); // Device identification String id = readSerialNumber(buf); diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java index a62a50e51..f95109b80 100644 --- a/src/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Crc; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -30,8 +33,8 @@ import org.traccar.model.Position; public class LaipacProtocolDecoder extends BaseProtocolDecoder { - public LaipacProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public LaipacProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -71,7 +74,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("laipac"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; // Identification diff --git a/src/org/traccar/protocol/M2mProtocolDecoder.java b/src/org/traccar/protocol/M2mProtocolDecoder.java index f54934536..46442fb4f 100644 --- a/src/org/traccar/protocol/M2mProtocolDecoder.java +++ b/src/org/traccar/protocol/M2mProtocolDecoder.java @@ -16,20 +16,23 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class M2mProtocolDecoder extends BaseProtocolDecoder { - public M2mProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public M2mProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private boolean firstPacket = true; @@ -75,7 +78,7 @@ public class M2mProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("m2m"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); // Date and time diff --git a/src/org/traccar/protocol/ManPowerProtocolDecoder.java b/src/org/traccar/protocol/ManPowerProtocolDecoder.java index d8bcdb937..449a1b532 100644 --- a/src/org/traccar/protocol/ManPowerProtocolDecoder.java +++ b/src/org/traccar/protocol/ManPowerProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class ManPowerProtocolDecoder extends BaseProtocolDecoder { - public ManPowerProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public ManPowerProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } static private Pattern pattern = Pattern.compile( @@ -64,7 +67,7 @@ public class ManPowerProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("manpower"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/MaxonProtocolDecoder.java b/src/org/traccar/protocol/MaxonProtocolDecoder.java index b6ba2fb4b..eb1e43885 100644 --- a/src/org/traccar/protocol/MaxonProtocolDecoder.java +++ b/src/org/traccar/protocol/MaxonProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.Position; @@ -43,8 +46,8 @@ public class MaxonProtocolDecoder extends BaseProtocolDecoder { /** * Initialize */ - public MaxonProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public MaxonProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } /** diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java index 96b2d564d..2eed12fce 100644 --- a/src/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class MegastekProtocolDecoder extends BaseProtocolDecoder { - public MegastekProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public MegastekProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern patternGPRMC = Pattern.compile( @@ -176,7 +179,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("megastek"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); // Parse location data if (!parseGPRMC(gprmc, position)) { diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index 6221ce4e7..7dcfdb200 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -18,15 +18,18 @@ package org.traccar.protocol; import java.net.InetSocketAddress; import java.nio.charset.Charset; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Crc; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -34,8 +37,8 @@ import org.traccar.model.Position; public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { - public MeiligaoProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public MeiligaoProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -114,10 +117,10 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { } private String getMeiligaoServer(Channel channel) { + Properties p = getProperties(); - if (getServerManager() != null && - getServerManager().getProperties().containsKey("meiligao.server")) { - return getServerManager().getProperties().getProperty("meiligao.server"); + if (p != null && p.containsKey(getProtocol() + ".server")) { + return p.getProperty(getProtocol() + ".server"); } else { InetSocketAddress address = (InetSocketAddress) channel.getLocalAddress(); return address.getAddress().getHostAddress() + ":" + address.getPort(); @@ -160,7 +163,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("meiligao"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); // Custom data if (command == MSG_ALARM) { diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 166c77e60..9df10c8fb 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -20,14 +20,17 @@ import java.util.Calendar; import java.util.Date; import java.util.LinkedList; import java.util.List; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -35,8 +38,8 @@ import org.traccar.model.Position; public class MeitrackProtocolDecoder extends BaseProtocolDecoder { - public MeitrackProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public MeitrackProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } //$$J163,123123123123123,AFF,0004,35,58.588926,16.180473,140928192856,A,10,27,0,161,1.2,19 @@ -81,7 +84,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("meitrack"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; @@ -182,7 +185,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { while (buf.readableBytes() >= 0x34) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("meitrack"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); // Event diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java index 2d524a23a..9a6c7396c 100644 --- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java +++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -31,8 +34,8 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { private Long deviceId; - public MiniFinderProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public MiniFinderProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -78,7 +81,7 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("minifinder"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); Integer index = 1; diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index 62fa87e68..d8d1b9f98 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -20,7 +20,9 @@ import java.util.Calendar; import java.util.Date; import java.util.LinkedList; import java.util.List; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; @@ -30,8 +32,9 @@ import org.jboss.netty.handler.codec.http.HttpRequest; import org.jboss.netty.handler.codec.http.HttpResponse; import org.jboss.netty.handler.codec.http.HttpResponseStatus; import org.jboss.netty.handler.codec.http.HttpVersion; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -41,8 +44,8 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { private boolean simple; - public Mta6ProtocolDecoder(ServerManager serverManager, boolean simple) { - super(serverManager); + public Mta6ProtocolDecoder(DataManager dataManager, String protocol, Properties properties, boolean simple) { + super(dataManager, protocol, properties); this.simple = simple; } @@ -129,7 +132,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { while (buf.readable()) { Position position = new Position(); position.setDeviceId(deviceId); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("mta6"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); short flags = buf.readUnsignedByte(); @@ -211,7 +214,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { private Position parseFormatA1(ChannelBuffer buf, long deviceId) { Position position = new Position(); position.setDeviceId(deviceId); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("mta6"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); short flags = buf.readUnsignedByte(); diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java index 29be1e5ad..eb9ad96d3 100644 --- a/src/org/traccar/protocol/NavigilProtocolDecoder.java +++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java @@ -17,12 +17,15 @@ package org.traccar.protocol; import java.nio.ByteOrder; import java.util.Date; +import java.util.Properties; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Crc; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -30,8 +33,8 @@ import org.traccar.model.Position; public class NavigilProtocolDecoder extends BaseProtocolDecoder { - public NavigilProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public NavigilProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final int LEAP_SECONDS_DELTA = 25; @@ -80,7 +83,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { private Position parseUnitReport(ChannelBuffer buf, long deviceId, int sequenceNumber) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setValid(true); extendedInfo.set("index", sequenceNumber); @@ -117,7 +120,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { private Position parseTg2Report(ChannelBuffer buf, long deviceId, int sequenceNumber) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setValid(true); extendedInfo.set("index", sequenceNumber); @@ -156,7 +159,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { private Position parsePositionReport(ChannelBuffer buf, long deviceId, int sequenceNumber, long timestamp) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); extendedInfo.set("index", sequenceNumber); position.setDeviceId(deviceId); @@ -180,7 +183,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { private Position parsePositionReport2(ChannelBuffer buf, long deviceId, int sequenceNumber, long timestamp) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); extendedInfo.set("index", sequenceNumber); position.setDeviceId(deviceId); @@ -207,7 +210,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { private Position parseSnapshot4(ChannelBuffer buf, long deviceId, int sequenceNumber) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); extendedInfo.set("index", sequenceNumber); position.setDeviceId(deviceId); @@ -248,7 +251,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder { private Position parseTrackingData(ChannelBuffer buf, long deviceId, int sequenceNumber, long timestamp) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navigil"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); extendedInfo.set("index", sequenceNumber); position.setDeviceId(deviceId); diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java index 1ee28e0aa..4646d215f 100644 --- a/src/org/traccar/protocol/NavisProtocolDecoder.java +++ b/src/org/traccar/protocol/NavisProtocolDecoder.java @@ -20,13 +20,16 @@ import java.nio.charset.Charset; import java.util.Calendar; import java.util.LinkedList; import java.util.List; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -41,8 +44,8 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { private String imei; private Long databaseDeviceId; - public NavisProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public NavisProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } // Format types @@ -83,7 +86,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { private ParseResult parsePosition(ChannelBuffer buf) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("navis"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(databaseDeviceId); position.setAltitude(0.0); diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java index 4cb35fee5..161d07a50 100644 --- a/src/org/traccar/protocol/NoranProtocolDecoder.java +++ b/src/org/traccar/protocol/NoranProtocolDecoder.java @@ -19,21 +19,24 @@ import java.net.SocketAddress; import java.nio.ByteOrder; import java.nio.charset.Charset; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class NoranProtocolDecoder extends BaseProtocolDecoder { - public NoranProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public NoranProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final int MSG_UPLOAD_POSITION = 0x0008; @@ -73,7 +76,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("noran"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); if (type == MSG_CONTROL_RESPONSE) { buf.readUnsignedInt(); // GIS ip diff --git a/src/org/traccar/protocol/OrionProtocolDecoder.java b/src/org/traccar/protocol/OrionProtocolDecoder.java index 1846bba23..6ba665614 100644 --- a/src/org/traccar/protocol/OrionProtocolDecoder.java +++ b/src/org/traccar/protocol/OrionProtocolDecoder.java @@ -18,21 +18,24 @@ package org.traccar.protocol; import java.util.Calendar; import java.util.LinkedList; import java.util.List; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class OrionProtocolDecoder extends BaseProtocolDecoder { - public OrionProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public OrionProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final int TYPE_USERLOG = 0; @@ -88,7 +91,7 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); position.setDeviceId(deviceId); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("orion"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); extendedInfo.set("event", buf.readUnsignedByte()); buf.readUnsignedByte(); // length diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java index e150275bd..d469e0b03 100644 --- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java +++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java @@ -21,6 +21,8 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.Properties; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelFutureListener; import org.jboss.netty.channel.ChannelHandlerContext; @@ -30,16 +32,17 @@ import org.jboss.netty.handler.codec.http.HttpResponse; import org.jboss.netty.handler.codec.http.HttpResponseStatus; import org.jboss.netty.handler.codec.http.HttpVersion; import org.jboss.netty.handler.codec.http.QueryStringDecoder; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class OsmAndProtocolDecoder extends BaseProtocolDecoder { - public OsmAndProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public OsmAndProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } @Override @@ -58,7 +61,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("osmand"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); // Identification String id = params.get(params.containsKey("id") ? "id" : "deviceid").get(0); diff --git a/src/org/traccar/protocol/PiligrimProtocolDecoder.java b/src/org/traccar/protocol/PiligrimProtocolDecoder.java index e0947b02a..02c86152d 100644 --- a/src/org/traccar/protocol/PiligrimProtocolDecoder.java +++ b/src/org/traccar/protocol/PiligrimProtocolDecoder.java @@ -20,7 +20,9 @@ import java.nio.charset.Charset; import java.util.Calendar; import java.util.LinkedList; import java.util.List; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; @@ -31,16 +33,17 @@ import org.jboss.netty.handler.codec.http.HttpResponse; import org.jboss.netty.handler.codec.http.HttpResponseStatus; import org.jboss.netty.handler.codec.http.HttpVersion; import org.jboss.netty.handler.codec.http.QueryStringDecoder; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class PiligrimProtocolDecoder extends BaseProtocolDecoder { - public PiligrimProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public PiligrimProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private void sendResponse(Channel channel, String message) { @@ -104,7 +107,7 @@ public class PiligrimProtocolDecoder extends BaseProtocolDecoder { if (type == MSG_GPS || type == MSG_GPS_SENSORS) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("piligrim"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); // Time diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java index 85680c039..3f120445c 100644 --- a/src/org/traccar/protocol/ProgressProtocolDecoder.java +++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java @@ -20,13 +20,16 @@ import java.nio.charset.Charset; import java.util.Calendar; import java.util.LinkedList; import java.util.List; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -40,8 +43,8 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder { private long lastIndex; private long newIndex; - public ProgressProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public ProgressProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } /* @@ -128,7 +131,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder { for (int j = 0; j < recordCount; j++) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("progress"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); // Message index diff --git a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java index 50b5aca02..86c438f6c 100644 --- a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java +++ b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Pt3000ProtocolDecoder extends BaseProtocolDecoder { - public Pt3000ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Pt3000ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } static private Pattern pattern = Pattern.compile( @@ -62,7 +65,7 @@ public class Pt3000ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("pt3000"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java index b324e3c55..72f95a0f6 100644 --- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java +++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java @@ -17,21 +17,24 @@ package org.traccar.protocol;
import java.util.Calendar;
+import java.util.Properties;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
+
import org.traccar.BaseProtocolDecoder;
-import org.traccar.ServerManager;
+import org.traccar.database.DataManager;
import org.traccar.helper.Log;
import org.traccar.model.ExtendedInfoFormatter;
import org.traccar.model.Position;
public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
- public Pt502ProtocolDecoder(ServerManager serverManager) {
- super(serverManager);
+ public Pt502ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) {
+ super(dataManager, protocol, properties);
}
private static final Pattern pattern = Pattern.compile(
@@ -63,7 +66,7 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder { // Create new position
Position position = new Position();
- ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("pt502");
+ ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
Integer index = 1;
diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java index aad68a37d..4bc04501c 100644 --- a/src/org/traccar/protocol/RitiProtocolDecoder.java +++ b/src/org/traccar/protocol/RitiProtocolDecoder.java @@ -17,14 +17,17 @@ package org.traccar.protocol; import java.nio.charset.Charset; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; @@ -32,8 +35,8 @@ import org.traccar.model.Position; public class RitiProtocolDecoder extends BaseProtocolDecoder { - public RitiProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public RitiProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -58,7 +61,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("riti"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); buf.skipBytes(2); // header diff --git a/src/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/org/traccar/protocol/RuptelaProtocolDecoder.java index c9f8bd392..0574aa2d8 100644 --- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java +++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java @@ -18,20 +18,23 @@ package org.traccar.protocol; import java.util.Date; import java.util.LinkedList; import java.util.List; +import java.util.Properties; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class RuptelaProtocolDecoder extends BaseProtocolDecoder { - public RuptelaProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public RuptelaProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final int COMMAND_RECORDS = 0x01; @@ -64,7 +67,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { for (int i = 0; i < count; i++) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("ruptela"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); // Time diff --git a/src/org/traccar/protocol/SanavProtocolDecoder.java b/src/org/traccar/protocol/SanavProtocolDecoder.java index e60209855..343dc87c8 100644 --- a/src/org/traccar/protocol/SanavProtocolDecoder.java +++ b/src/org/traccar/protocol/SanavProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class SanavProtocolDecoder extends BaseProtocolDecoder { - public SanavProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public SanavProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -62,7 +65,7 @@ public class SanavProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("sanav"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; // Identification diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java index 4c7829bf6..aa47e42fb 100644 --- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java +++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java @@ -17,20 +17,23 @@ package org.traccar.protocol; import java.nio.charset.Charset; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { - public SkypatrolProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public SkypatrolProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static boolean checkBit(long mask, int bit) { @@ -76,7 +79,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("skypatrol"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); // Status code if (checkBit(mask, 1)) { diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java index 211483aed..51af0941e 100644 --- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java +++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Stl060ProtocolDecoder extends BaseProtocolDecoder { - public Stl060ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Stl060ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -67,7 +70,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("stl060"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java index 124b4feaf..868425e8d 100644 --- a/src/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class SuntechProtocolDecoder extends BaseProtocolDecoder { - public SuntechProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public SuntechProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } static private Pattern pattern = Pattern.compile( @@ -62,7 +65,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("suntech"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); int index = 1; // Identifier diff --git a/src/org/traccar/protocol/SyrusProtocolDecoder.java b/src/org/traccar/protocol/SyrusProtocolDecoder.java index 0d61daf82..72347ac03 100644 --- a/src/org/traccar/protocol/SyrusProtocolDecoder.java +++ b/src/org/traccar/protocol/SyrusProtocolDecoder.java @@ -17,13 +17,16 @@ package org.traccar.protocol; import java.util.Calendar; import java.util.Date; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -32,8 +35,9 @@ public class SyrusProtocolDecoder extends BaseProtocolDecoder { boolean sendResponse; - public SyrusProtocolDecoder(ServerManager serverManager, boolean sendResponse) { - super(serverManager); + + public SyrusProtocolDecoder(DataManager dataManager, String protocol, Properties properties, boolean sendResponse) { + super(dataManager, protocol, properties); this.sendResponse = sendResponse; } @@ -132,7 +136,7 @@ public class SyrusProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("syrus"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); Integer index = 1; diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index da473d994..0f2da7d65 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -31,8 +34,8 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { private Long deviceId; - public T55ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public T55ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern patternGPRMC = Pattern.compile( @@ -143,7 +146,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("t55"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); Integer index = 1; @@ -210,7 +213,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("t55"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); Integer index = 1; @@ -262,7 +265,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("t55"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); Integer index = 1; @@ -319,7 +322,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("t55"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); Integer index = 1; diff --git a/src/org/traccar/protocol/TelikProtocolDecoder.java b/src/org/traccar/protocol/TelikProtocolDecoder.java index d632cc478..84dd6fb0b 100644 --- a/src/org/traccar/protocol/TelikProtocolDecoder.java +++ b/src/org/traccar/protocol/TelikProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class TelikProtocolDecoder extends BaseProtocolDecoder { - public TelikProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public TelikProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -62,7 +65,7 @@ public class TelikProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("telik"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 876a1e4ff..62d3db539 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -19,12 +19,15 @@ import java.nio.charset.Charset; import java.util.Date; import java.util.LinkedList; import java.util.List; +import java.util.Properties; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -33,8 +36,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { private long deviceId; - public TeltonikaProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public TeltonikaProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private void parseIdentification(Channel channel, ChannelBuffer buf) { @@ -81,7 +84,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { for (int i = 0; i < count; i++) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("teltonika"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); diff --git a/src/org/traccar/protocol/Tk102ProtocolDecoder.java b/src/org/traccar/protocol/Tk102ProtocolDecoder.java index e142d95b5..bb9a5fbd2 100644 --- a/src/org/traccar/protocol/Tk102ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk102ProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -31,8 +34,8 @@ public class Tk102ProtocolDecoder extends BaseProtocolDecoder { private Long deviceId; - public Tk102ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Tk102ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } static private Pattern pattern = Pattern.compile( @@ -85,7 +88,7 @@ public class Tk102ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("tk102"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); Integer index = 1; diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java index d3220368a..f5ce44c60 100644 --- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Tk103ProtocolDecoder extends BaseProtocolDecoder { - public Tk103ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Tk103ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -82,7 +85,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("tk103"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; // Get device by IMEI diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java index e4e6cb300..0e17fc70c 100644 --- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java +++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java @@ -18,21 +18,24 @@ package org.traccar.protocol; import java.util.Calendar; import java.util.LinkedList; import java.util.List; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Tlt2hProtocolDecoder extends BaseProtocolDecoder { - public Tlt2hProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Tlt2hProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern patternHeader = Pattern.compile( @@ -91,7 +94,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder { parser = patternPosition.matcher(message); if (parser.matches()) { Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("tlt2h"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); Integer index = 1; diff --git a/src/org/traccar/protocol/TopflytechProtocolDecoder.java b/src/org/traccar/protocol/TopflytechProtocolDecoder.java index 58448f881..9e9a7e3e3 100644 --- a/src/org/traccar/protocol/TopflytechProtocolDecoder.java +++ b/src/org/traccar/protocol/TopflytechProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -31,8 +34,8 @@ public class TopflytechProtocolDecoder extends BaseProtocolDecoder { private Long deviceId; - public TopflytechProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public TopflytechProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } static private Pattern pattern = Pattern.compile( @@ -64,7 +67,7 @@ public class TopflytechProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("topflytech"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; // Identifier diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index 466929777..5e49141b7 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class TotemProtocolDecoder extends BaseProtocolDecoder { - public TotemProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public TotemProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern patternFirst = Pattern.compile( @@ -159,7 +162,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("totem"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/org/traccar/protocol/Tr20ProtocolDecoder.java index de21f4420..fb6f319d5 100644 --- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Tr20ProtocolDecoder extends BaseProtocolDecoder { - public Tr20ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Tr20ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } static private Pattern patternPing = Pattern.compile( @@ -77,7 +80,7 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("tr20"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/TrackboxProtocolDecoder.java b/src/org/traccar/protocol/TrackboxProtocolDecoder.java index 865d81e30..186bc24cd 100644 --- a/src/org/traccar/protocol/TrackboxProtocolDecoder.java +++ b/src/org/traccar/protocol/TrackboxProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -31,8 +34,8 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder { private Long deviceId; - public TrackboxProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public TrackboxProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -82,7 +85,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); position.setDeviceId(deviceId); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("trackbox"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java index 25c943e57..81fd393e0 100644 --- a/src/org/traccar/protocol/V680ProtocolDecoder.java +++ b/src/org/traccar/protocol/V680ProtocolDecoder.java @@ -16,13 +16,16 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -31,8 +34,8 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { private Long deviceId; - public V680ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public V680ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -80,7 +83,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("v680"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; // Get device by IMEI diff --git a/src/org/traccar/protocol/VisiontekProtocolDecoder.java b/src/org/traccar/protocol/VisiontekProtocolDecoder.java index 4ca97be67..242ac1083 100644 --- a/src/org/traccar/protocol/VisiontekProtocolDecoder.java +++ b/src/org/traccar/protocol/VisiontekProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class VisiontekProtocolDecoder extends BaseProtocolDecoder { - public VisiontekProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public VisiontekProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -71,7 +74,7 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("visiontek"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java index 93e32ced0..65cc17bcd 100644 --- a/src/org/traccar/protocol/WialonProtocolDecoder.java +++ b/src/org/traccar/protocol/WialonProtocolDecoder.java @@ -18,13 +18,16 @@ package org.traccar.protocol; import java.util.Calendar; import java.util.LinkedList; import java.util.List; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; @@ -33,8 +36,8 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { private Long deviceId; - public WialonProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public WialonProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -71,7 +74,7 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("wialon"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); position.setDeviceId(deviceId); Integer index = 1; diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java index a9c4ea4c1..a9068e7be 100644 --- a/src/org/traccar/protocol/WondexProtocolDecoder.java +++ b/src/org/traccar/protocol/WondexProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class WondexProtocolDecoder extends BaseProtocolDecoder { - public WondexProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public WondexProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -65,7 +68,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("wondex"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); int index = 1; // Device identifier diff --git a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java index d974ce227..3a9e1129e 100644 --- a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java +++ b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Xexun2ProtocolDecoder extends BaseProtocolDecoder { - public Xexun2ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Xexun2ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } static private Pattern pattern = Pattern.compile( @@ -72,7 +75,7 @@ public class Xexun2ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("xexun2"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java index 7a0d71e64..01ce44964 100644 --- a/src/org/traccar/protocol/XexunProtocolDecoder.java +++ b/src/org/traccar/protocol/XexunProtocolDecoder.java @@ -17,21 +17,24 @@ package org.traccar.protocol; import java.text.ParseException; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class XexunProtocolDecoder extends BaseProtocolDecoder { - public XexunProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public XexunProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -62,7 +65,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("xexun"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; diff --git a/src/org/traccar/protocol/Xt7ProtocolDecoder.java b/src/org/traccar/protocol/Xt7ProtocolDecoder.java index a30977263..bd46cee37 100644 --- a/src/org/traccar/protocol/Xt7ProtocolDecoder.java +++ b/src/org/traccar/protocol/Xt7ProtocolDecoder.java @@ -17,22 +17,25 @@ package org.traccar.protocol; import java.nio.charset.Charset; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class Xt7ProtocolDecoder extends BaseProtocolDecoder { - public Xt7ProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public Xt7ProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -67,7 +70,7 @@ public class Xt7ProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("xt7"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); // Get device by id String id = buf.readBytes(16).toString(Charset.defaultCharset()).trim(); diff --git a/src/org/traccar/protocol/YwtProtocolDecoder.java b/src/org/traccar/protocol/YwtProtocolDecoder.java index 2b189ea7c..5392a4ccf 100644 --- a/src/org/traccar/protocol/YwtProtocolDecoder.java +++ b/src/org/traccar/protocol/YwtProtocolDecoder.java @@ -16,21 +16,24 @@ package org.traccar.protocol; import java.util.Calendar; +import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; + import org.traccar.BaseProtocolDecoder; -import org.traccar.ServerManager; +import org.traccar.database.DataManager; import org.traccar.helper.Log; import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class YwtProtocolDecoder extends BaseProtocolDecoder { - public YwtProtocolDecoder(ServerManager serverManager) { - super(serverManager); + public YwtProtocolDecoder(DataManager dataManager, String protocol, Properties properties) { + super(dataManager, protocol, properties); } private static final Pattern pattern = Pattern.compile( @@ -81,7 +84,7 @@ public class YwtProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter("ywt"); + ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); Integer index = 1; String type = parser.group(index++); |