aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorjon-stumpf <jon.stumpf@gmail.com>2014-10-10 19:23:21 -0400
committerjon-stumpf <jon.stumpf@gmail.com>2014-10-21 16:01:41 -0400
commit1948e0f63202dddca607dcb51fa9a92a83e49154 (patch)
tree3771c3d64b219704cbbb2cb8f69ac941dbb34da0 /src/org
parent8876e964cf26a090d11fd855642c95bc02a17c7f (diff)
downloadtrackermap-server-1948e0f63202dddca607dcb51fa9a92a83e49154.tar.gz
trackermap-server-1948e0f63202dddca607dcb51fa9a92a83e49154.tar.bz2
trackermap-server-1948e0f63202dddca607dcb51fa9a92a83e49154.zip
Eliminated the need for hardcoded protocol strings in the src/org/traccar/protocol/*ProtocolDecoder.java files.
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java25
-rw-r--r--src/org/traccar/ServerManager.java292
-rw-r--r--src/org/traccar/protocol/ApelProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/AplicomProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/AtrackProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/BoxProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/CarTrackProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/CarscopProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/CellocatorProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/EasyTrackProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/EnforaProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Ev603ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/FreedomProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/GalileoProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/GatorProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Gl100ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/GlobalSatProtocolDecoder.java25
-rw-r--r--src/org/traccar/protocol/GotopProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/GpsGateProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Gt02ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java10
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/HaicomProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/KhdProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/LaipacProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/M2mProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/ManPowerProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/MaxonProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java10
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/MiniFinderProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Mta6ProtocolDecoder.java10
-rw-r--r--src/org/traccar/protocol/NavigilProtocolDecoder.java16
-rw-r--r--src/org/traccar/protocol/NavisProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/NoranProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/OrionProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/OsmAndProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/PiligrimProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/ProgressProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Pt3000ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/RitiProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/RuptelaProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/SanavProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/SkypatrolProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Stl060ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/SyrusProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/TelikProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Tk102ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/TopflytechProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Tr20ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/TrackboxProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/VisiontekProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/WialonProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/WondexProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Xexun2ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Xt7ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/YwtProtocolDecoder.java6
72 files changed, 557 insertions, 234 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java
index e23367278..3976ba9e8 100644
--- a/src/org/traccar/BaseProtocolDecoder.java
+++ b/src/org/traccar/BaseProtocolDecoder.java
@@ -31,6 +31,7 @@ public abstract class BaseProtocolDecoder extends OneToOneDecoder {
private ServerManager serverManager;
private DataManager dataManager;
+ private final String protocol;
public final void setDataManager(DataManager dataManager) {
this.dataManager = dataManager;
@@ -48,14 +49,38 @@ public abstract class BaseProtocolDecoder extends OneToOneDecoder {
return serverManager;
}
+ public final String getProtocol() {
+ return protocol;
+ }
+
public BaseProtocolDecoder() {
+ protocol = null;
}
public BaseProtocolDecoder(ServerManager serverManager) {
+ // Only used by test classes now
+ assert (serverManager == null) :
+ "BaseProtocolDecoder() initialized with non-NULL serverManager";
+
if (serverManager != null) {
this.serverManager = serverManager;
dataManager = serverManager.getDataManager();
}
+
+ protocol = null;
+ }
+
+ public BaseProtocolDecoder(ServerManager serverManager, String protocol) {
+ assert (serverManager != null) :
+ "BaseProtocolDecoder() initialized with NULL serverManager";
+
+ assert (protocol != null) :
+ "BaseProtocolDecoder() initialized with NULL protocol";
+
+ this.serverManager = serverManager;
+ this.protocol = protocol;
+
+ dataManager = serverManager.getDataManager();
}
@Override
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java
index 33d364cc4..9edb1cf5e 100644
--- a/src/org/traccar/ServerManager.java
+++ b/src/org/traccar/ServerManager.java
@@ -228,20 +228,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(ServerManager.this, protocol));
}
});
}
}
- 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 +255,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(ServerManager.this, protocol));
}
});
serverList.add(new TrackerServer(this, new ConnectionlessBootstrap(), protocol) {
@@ -263,13 +263,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(ServerManager.this, protocol));
}
});
}
}
- 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 +279,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(ServerManager.this, protocol));
}
});
serverList.add(new TrackerServer(this, new ConnectionlessBootstrap(), protocol) {
@@ -287,13 +287,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(ServerManager.this, protocol));
}
});
}
}
- 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 +303,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(ServerManager.this, protocol));
}
});
}
}
- 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 +322,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(ServerManager.this, protocol));
}
});
}
}
- 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 +338,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(ServerManager.this, protocol));
}
});
}
}
- 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 +353,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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 +406,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(ServerManager.this, protocol));
}
});
}
}
- 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 +421,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
@@ -441,31 +441,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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 +474,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(ServerManager.this, protocol));
}
});
}
}
- 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 +489,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
@@ -510,7 +510,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 +520,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
@@ -540,14 +540,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(ServerManager.this, protocol));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
@@ -555,42 +555,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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 +598,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
@@ -618,7 +618,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 +628,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol, 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(ServerManager.this, protocol, 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 +682,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(ServerManager.this, protocol));
}
});
}
}
- 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 +698,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(ServerManager.this, protocol, 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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
@@ -731,13 +731,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(ServerManager.this, protocol));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
@@ -745,7 +745,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 +755,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(ServerManager.this, protocol));
}
});
}
}
- 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 +771,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(ServerManager.this, protocol));
}
});
}
}
- 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 +785,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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 +811,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(ServerManager.this, protocol));
}
});
}
}
- 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 +827,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
@@ -847,7 +847,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 +857,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(ServerManager.this, protocol));
}
});
}
}
- 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 +873,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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 +901,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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 +928,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(ServerManager.this, protocol));
}
});
}
}
- 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 +942,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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 +969,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(ServerManager.this, protocol));
}
});
}
}
- 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 +984,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
@@ -1014,32 +1014,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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 +1048,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol, 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(ServerManager.this, protocol));
}
});
}
}
- 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 +1086,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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 +1114,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(ServerManager.this, protocol));
}
});
}
}
- 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 +1129,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(ServerManager.this, protocol));
}
});
}
}
- 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 +1144,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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 +1171,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
});
}
}
- 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 +1199,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(ServerManager.this, protocol));
}
});
}
}
- 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 +1213,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(ServerManager.this, protocol));
}
});
}
}
- 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 +1228,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(ServerManager.this, protocol));
}
});
}
}
- 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(ServerManager.this, protocol));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
@@ -1248,13 +1248,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(ServerManager.this, protocol));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java
index 54b112b59..954006807 100644
--- a/src/org/traccar/protocol/ApelProtocolDecoder.java
+++ b/src/org/traccar/protocol/ApelProtocolDecoder.java
@@ -42,6 +42,10 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public ApelProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
/*
* Message types
*/
@@ -165,7 +169,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..468e4a5fc 100644
--- a/src/org/traccar/protocol/AplicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java
@@ -31,6 +31,10 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public AplicomProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final long IMEI_BASE_TC65_V20 = 0x1437207000000L;
private static final long IMEI_BASE_TC65_V28 = 358244010000000L;
private static final long IMEI_BASE_TC65I_V11 = 0x14143B4000000L;
@@ -124,7 +128,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..7edafa057 100644
--- a/src/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -35,6 +35,10 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public AtrackProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final int MSG_HEARTBEAT = 0x1A;
private static final int MSG_DATA = 0x10;
@@ -96,7 +100,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..4184ee0e2 100644
--- a/src/org/traccar/protocol/BoxProtocolDecoder.java
+++ b/src/org/traccar/protocol/BoxProtocolDecoder.java
@@ -35,6 +35,10 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public BoxProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"L," +
"(\\d{2})(\\d{2})(\\d{2})" + // Date
@@ -79,7 +83,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..aa02ba044 100644
--- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
@@ -34,6 +34,10 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public CarTrackProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"\\$\\$" + // Header
"(\\d+)\\?*" + // Device ID
@@ -70,7 +74,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..6683a463f 100644
--- a/src/org/traccar/protocol/CarscopProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarscopProtocolDecoder.java
@@ -35,6 +35,10 @@ public class CarscopProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public CarscopProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
// Very similar to TK103 protocol
static private Pattern pattern = Pattern.compile(
"\\*.*" +
@@ -80,7 +84,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..8cce47bd5 100644
--- a/src/org/traccar/protocol/CellocatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/CellocatorProtocolDecoder.java
@@ -34,6 +34,10 @@ public class CellocatorProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public CellocatorProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private String readImei(ChannelBuffer buf) {
int b = buf.readUnsignedByte();
StringBuilder imei = new StringBuilder();
@@ -103,7 +107,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..87a0135eb 100644
--- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
@@ -33,6 +33,10 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public EasyTrackProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
//ET,358155100003016,HB,A,0d081e,07381e,8038ee09,03d2e9be,004f,0000,40c00000,0f,100,0000,00037c,29
static private Pattern pattern = Pattern.compile(
"\\*..," + // Manufacturer
@@ -74,7 +78,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..97c2821b5 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -36,6 +36,10 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public EelinkProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private String readImei(ChannelBuffer buf) {
int b = buf.readUnsignedByte();
StringBuilder imei = new StringBuilder();
@@ -105,7 +109,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..0509b0c6d 100644
--- a/src/org/traccar/protocol/EnforaProtocolDecoder.java
+++ b/src/org/traccar/protocol/EnforaProtocolDecoder.java
@@ -36,6 +36,10 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public EnforaProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"GPRMC," +
"(\\d{2})(\\d{2})(\\d{2}).(\\d+)," + // Time (HHMMSS.SS)
@@ -94,7 +98,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..c73067b0c 100644
--- a/src/org/traccar/protocol/Ev603ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Ev603ProtocolDecoder.java
@@ -36,6 +36,10 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder{
super(serverManager);
}
+ public Ev603ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"!A," + // Type
"(\\d{2})\\/(\\d{2})\\/(\\d{2})," + // Date dd/mm/YY
@@ -74,7 +78,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..0acff7f22 100644
--- a/src/org/traccar/protocol/FreedomProtocolDecoder.java
+++ b/src/org/traccar/protocol/FreedomProtocolDecoder.java
@@ -33,6 +33,10 @@ public class FreedomProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public FreedomProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"IMEI," +
"(\\d+)," + // IMEI
@@ -56,7 +60,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..cb29a0920 100644
--- a/src/org/traccar/protocol/GalileoProtocolDecoder.java
+++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java
@@ -40,6 +40,10 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public GalileoProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final int TAG_IMEI = 0x03;
private static final int TAG_DATE = 0x20;
private static final int TAG_COORDINATES = 0x30;
@@ -97,7 +101,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 +112,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..7f93082fd 100644
--- a/src/org/traccar/protocol/GatorProtocolDecoder.java
+++ b/src/org/traccar/protocol/GatorProtocolDecoder.java
@@ -33,6 +33,10 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public GatorProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final int PACKET_HEARTBEAT = 0x21;
private static final int PACKET_POSITION_DATA = 0x80;
private static final int PACKET_ROLLCALL_RESPONSE = 0x81;
@@ -66,7 +70,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..0dac5d2b3 100644
--- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
@@ -33,6 +33,10 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Gl100ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"\\+RESP:GT...," +
"(\\d{15})," + // IMEI
@@ -74,7 +78,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..83fd42b74 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -33,6 +33,10 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Gl200ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"\\+(?:RESP|BUFF):GT...," +
"[0-9a-fA-F]{6}," + // Protocol version
@@ -67,7 +71,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..bd56fde1f 100644
--- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
+++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
@@ -36,6 +36,10 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
public GlobalSatProtocolDecoder(ServerManager serverManager) {
super(serverManager);
+ // This is now only called by test classes.
+ // This will be deleted in the next commit.
+ assert (serverManager == null);
+
// Initialize format strings
format0 = "TSPRXAB27GHKLMnaicz*U!";
format1 = "SARY*U!";
@@ -49,6 +53,23 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
}
}
}
+
+ public GlobalSatProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+
+ // Initialize format strings
+ format0 = "TSPRXAB27GHKLMnaicz*U!";
+ format1 = "SARY*U!";
+ if (getServerManager() != null) {
+ Properties p = getServerManager().getProperties();
+ if (p.containsKey(protocol + ".format0")) {
+ format0 = p.getProperty(protocol + ".format0");
+ }
+ if (p.containsKey(protocol + ".format1")) {
+ format1 = p.getProperty(protocol + ".format1");
+ }
+ }
+ }
private Position decodeOriginal(Channel channel, String sentence) {
@@ -83,7 +104,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 +225,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..70d0063a1 100644
--- a/src/org/traccar/protocol/GotopProtocolDecoder.java
+++ b/src/org/traccar/protocol/GotopProtocolDecoder.java
@@ -33,6 +33,10 @@ public class GotopProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public GotopProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"(\\d+)," + // IMEI
"[^,]+," + // Type
@@ -60,7 +64,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..ca578841a 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -34,6 +34,10 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Gps103ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"imei:" +
"(\\d+)," + // IMEI
@@ -88,7 +92,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..bc8c759c3 100644
--- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
@@ -36,6 +36,10 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public GpsGateProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
/**
* Regular expressions pattern
*/
@@ -104,7 +108,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..8e351f456 100644
--- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java
@@ -33,6 +33,10 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Gt02ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private String readImei(ChannelBuffer buf) {
int b = buf.readUnsignedByte();
StringBuilder imei = new StringBuilder();
@@ -77,7 +81,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..f1e8585e5 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -36,12 +36,16 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
public Gt06ProtocolDecoder(ServerManager serverManager) {
super(serverManager);
+ }
+
+ public Gt06ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
if (serverManager != null) {
Properties p = getServerManager().getProperties();
- if (p.containsKey("gt06.timezone")) {
+ if (p.containsKey(protocol + ".timezone")) {
timeZone.setRawOffset(
- Integer.valueOf(p.getProperty("gt06.timezone")) * 1000);
+ Integer.valueOf(p.getProperty(protocol + ".timezone")) * 1000);
}
}
}
@@ -144,7 +148,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..f7843e2c8 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -35,6 +35,10 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
public H02ProtocolDecoder(ServerManager serverManager) {
super(serverManager);
}
+
+ public H02ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
private static double readCoordinate(ChannelBuffer buf, boolean lon) {
@@ -59,7 +63,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 +137,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..199093492 100644
--- a/src/org/traccar/protocol/HaicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java
@@ -33,6 +33,10 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public HaicomProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"\\$GPRS" +
"(\\d+)," + // IMEI
@@ -67,7 +71,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..fe093a033 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -33,6 +33,10 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public IntellitracProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"(?:.+,)?(\\d+)," + // Device Identifier
"(\\d{4})(\\d{2})(\\d{2})" + // Date (YYYYMMDD)
@@ -76,7 +80,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..7f67daafe 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -36,10 +36,14 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Jt600ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
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 +162,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..e8716ffd0 100644
--- a/src/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/org/traccar/protocol/KhdProtocolDecoder.java
@@ -35,6 +35,10 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public KhdProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private String readSerialNumber(ChannelBuffer buf) {
int b1 = buf.readUnsignedByte();
int b2 = buf.readUnsignedByte(); if (b2 > 0x80) b2 -= 0x80;
@@ -73,7 +77,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..cba86f7b4 100644
--- a/src/org/traccar/protocol/LaipacProtocolDecoder.java
+++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java
@@ -34,6 +34,10 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public LaipacProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"\\$AVRMC," +
"([^,]+)," + // Identifier
@@ -71,7 +75,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..2a0c8ebaf 100644
--- a/src/org/traccar/protocol/M2mProtocolDecoder.java
+++ b/src/org/traccar/protocol/M2mProtocolDecoder.java
@@ -31,6 +31,10 @@ public class M2mProtocolDecoder extends BaseProtocolDecoder {
public M2mProtocolDecoder(ServerManager serverManager) {
super(serverManager);
}
+
+ public M2mProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
private boolean firstPacket = true;
private Long deviceId;
@@ -75,7 +79,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..57b47ce5e 100644
--- a/src/org/traccar/protocol/ManPowerProtocolDecoder.java
+++ b/src/org/traccar/protocol/ManPowerProtocolDecoder.java
@@ -33,6 +33,10 @@ public class ManPowerProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public ManPowerProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
static private Pattern pattern = Pattern.compile(
"simei:" +
"(\\d+)," + // IMEI
@@ -64,7 +68,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..c1e9e4ec5 100644
--- a/src/org/traccar/protocol/MaxonProtocolDecoder.java
+++ b/src/org/traccar/protocol/MaxonProtocolDecoder.java
@@ -47,6 +47,10 @@ public class MaxonProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public MaxonProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
/**
* Regular expressions pattern
*/
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index 96b2d564d..a4e25510d 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -33,6 +33,10 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public MegastekProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern patternGPRMC = Pattern.compile(
"\\$GPRMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.\\d+," + // Time (HHMMSS.SSS)
@@ -176,7 +180,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..73b238443 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -38,6 +38,10 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public MeiligaoProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"(\\d{2})(\\d{2})(\\d{2})\\.?(\\d+)?," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
@@ -116,8 +120,8 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
private String getMeiligaoServer(Channel channel) {
if (getServerManager() != null &&
- getServerManager().getProperties().containsKey("meiligao.server")) {
- return getServerManager().getProperties().getProperty("meiligao.server");
+ getServerManager().getProperties().containsKey(getProtocol() + ".server")) {
+ return getServerManager().getProperties().getProperty(getProtocol() + ".server");
} else {
InetSocketAddress address = (InetSocketAddress) channel.getLocalAddress();
return address.getAddress().getHostAddress() + ":" + address.getPort();
@@ -160,7 +164,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..972f69061 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -39,6 +39,10 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public MeitrackProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
//$$J163,123123123123123,AFF,0004,35,58.588926,16.180473,140928192856,A,10,27,0,161,1.2,19
//,1648894,435695,240|24|88B9|E435,0000,|||0A22|0000,00000001,,50,,,,,,,,,,,,,*70\r\n
private static final Pattern pattern = Pattern.compile(
@@ -81,7 +85,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 +186,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..96057f347 100644
--- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
+++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
@@ -35,6 +35,10 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public MiniFinderProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"\\!D," +
"(\\d+)/(\\d+)/(\\d+)," + // Date
@@ -78,7 +82,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..0908a5793 100644
--- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java
@@ -41,8 +41,12 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder {
private boolean simple;
- public Mta6ProtocolDecoder(ServerManager serverManager, boolean simple) {
+ public Mta6ProtocolDecoder(ServerManager serverManager) {
super(serverManager);
+ }
+
+ public Mta6ProtocolDecoder(ServerManager serverManager, String protocol, boolean simple) {
+ super(serverManager, protocol);
this.simple = simple;
}
@@ -129,7 +133,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 +215,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..938426297 100644
--- a/src/org/traccar/protocol/NavigilProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java
@@ -33,6 +33,10 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
public NavigilProtocolDecoder(ServerManager serverManager) {
super(serverManager);
}
+
+ public NavigilProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
private static final int LEAP_SECONDS_DELTA = 25;
@@ -80,7 +84,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 +121,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 +160,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 +184,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 +211,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 +252,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..fe4b04543 100644
--- a/src/org/traccar/protocol/NavisProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavisProtocolDecoder.java
@@ -45,6 +45,10 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public NavisProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
// Format types
public static final int F10 = 0x01;
public static final int F20 = 0x02;
@@ -83,7 +87,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..207975aec 100644
--- a/src/org/traccar/protocol/NoranProtocolDecoder.java
+++ b/src/org/traccar/protocol/NoranProtocolDecoder.java
@@ -36,6 +36,10 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public NoranProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final int MSG_UPLOAD_POSITION = 0x0008;
private static final int MSG_CONTROL_RESPONSE = 0x8009;
private static final int MSG_ALARM = 0x0003;
@@ -73,7 +77,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..ed0e7c169 100644
--- a/src/org/traccar/protocol/OrionProtocolDecoder.java
+++ b/src/org/traccar/protocol/OrionProtocolDecoder.java
@@ -34,6 +34,10 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder {
public OrionProtocolDecoder(ServerManager serverManager) {
super(serverManager);
}
+
+ public OrionProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
private static final int TYPE_USERLOG = 0;
private static final int TYPE_SYSLOG = 3;
@@ -88,7 +92,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..7c76ea851 100644
--- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java
+++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
@@ -41,6 +41,10 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
public OsmAndProtocolDecoder(ServerManager serverManager) {
super(serverManager);
}
+
+ public OsmAndProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
@Override
protected Object decode(
@@ -58,7 +62,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..db051c39f 100644
--- a/src/org/traccar/protocol/PiligrimProtocolDecoder.java
+++ b/src/org/traccar/protocol/PiligrimProtocolDecoder.java
@@ -43,6 +43,10 @@ public class PiligrimProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public PiligrimProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private void sendResponse(Channel channel, String message) {
if (channel != null) {
HttpResponse response = new DefaultHttpResponse(
@@ -104,7 +108,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..492c5afd3 100644
--- a/src/org/traccar/protocol/ProgressProtocolDecoder.java
+++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java
@@ -44,6 +44,10 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public ProgressProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
/*
* Message types
*/
@@ -128,7 +132,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..8767b0f7c 100644
--- a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
@@ -33,6 +33,10 @@ public class Pt3000ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Pt3000ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
static private Pattern pattern = Pattern.compile(
"\\%(\\d+)," + // IMEI
"\\$GPRMC," +
@@ -62,7 +66,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..c555a3690 100644
--- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -34,6 +34,10 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Pt502ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
".*\\$POS," + // Data Frame start
"(\\d+)," + // Id
@@ -63,7 +67,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..1c7a0500b 100644
--- a/src/org/traccar/protocol/RitiProtocolDecoder.java
+++ b/src/org/traccar/protocol/RitiProtocolDecoder.java
@@ -36,6 +36,10 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public RitiProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"\\$GPRMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.?\\d*," + // Time (HHMMSS.SSS)
@@ -58,7 +62,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..c5d678a06 100644
--- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java
+++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java
@@ -34,6 +34,10 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public RuptelaProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final int COMMAND_RECORDS = 0x01;
@Override
@@ -64,7 +68,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..d09065355 100644
--- a/src/org/traccar/protocol/SanavProtocolDecoder.java
+++ b/src/org/traccar/protocol/SanavProtocolDecoder.java
@@ -33,6 +33,10 @@ public class SanavProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public SanavProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
".*imei[:=]" +
"(\\d+)" + // IMEI
@@ -62,7 +66,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..5ef8a09a4 100644
--- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
+++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java
@@ -33,6 +33,10 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public SkypatrolProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static boolean checkBit(long mask, int bit) {
long checkMask = 1 << bit;
return (mask & checkMask) == checkMask;
@@ -76,7 +80,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..77d7ed3bf 100644
--- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
@@ -33,6 +33,10 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Stl060ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
".*\\$1," +
"(\\d+)," + // IMEI
@@ -67,7 +71,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..5b5f4f136 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -33,6 +33,10 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public SuntechProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
static private Pattern pattern = Pattern.compile(
"S.\\d{3}(?:\\w{3})?;" + // Header
"(?:[^;]+;)?" +
@@ -62,7 +66,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..fc307d09a 100644
--- a/src/org/traccar/protocol/SyrusProtocolDecoder.java
+++ b/src/org/traccar/protocol/SyrusProtocolDecoder.java
@@ -37,6 +37,11 @@ public class SyrusProtocolDecoder extends BaseProtocolDecoder {
this.sendResponse = sendResponse;
}
+ public SyrusProtocolDecoder(ServerManager serverManager, String protocol, boolean sendResponse) {
+ super(serverManager, protocol);
+ this.sendResponse = sendResponse;
+ }
+
private static final Pattern pattern = Pattern.compile(
"R[EP]V" + // Type
"(?:\\d{2}" + // Event index
@@ -132,7 +137,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..c3128bf97 100644
--- a/src/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/org/traccar/protocol/T55ProtocolDecoder.java
@@ -35,6 +35,10 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public T55ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern patternGPRMC = Pattern.compile(
"\\$GPRMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.?\\d*," + // Time (HHMMSS.SSS)
@@ -143,7 +147,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 +214,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 +266,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 +323,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..0f5e3794b 100644
--- a/src/org/traccar/protocol/TelikProtocolDecoder.java
+++ b/src/org/traccar/protocol/TelikProtocolDecoder.java
@@ -33,6 +33,10 @@ public class TelikProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public TelikProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"\\d{4}" +
"(\\d{6})" + // Device ID
@@ -62,7 +66,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..5f7ce1638 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -37,6 +37,10 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public TeltonikaProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private void parseIdentification(Channel channel, ChannelBuffer buf) {
boolean result = false;
@@ -81,7 +85,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..9b1157d50 100644
--- a/src/org/traccar/protocol/Tk102ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk102ProtocolDecoder.java
@@ -35,6 +35,10 @@ public class Tk102ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Tk102ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
static private Pattern pattern = Pattern.compile(
"\\[.\\d{10}.\\(\\p{Upper}+" +
"(\\d{2})(\\d{2})(\\d{2})" + // Time (HHMMSS)
@@ -85,7 +89,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..2309012ab 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -33,6 +33,10 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Tk103ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"(\\d+)(,)?" + // Device ID
".{4},?" + // Command
@@ -82,7 +86,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..0f5bc5275 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -35,6 +35,10 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Tlt2hProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern patternHeader = Pattern.compile(
"#(\\d+)#" + // IMEI
"[^#]+#" +
@@ -91,7 +95,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..112b1e183 100644
--- a/src/org/traccar/protocol/TopflytechProtocolDecoder.java
+++ b/src/org/traccar/protocol/TopflytechProtocolDecoder.java
@@ -35,6 +35,10 @@ public class TopflytechProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public TopflytechProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
static private Pattern pattern = Pattern.compile(
"\\(" +
"(\\d+)" + // IMEI
@@ -64,7 +68,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..180289b20 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -33,6 +33,10 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public TotemProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern patternFirst = Pattern.compile(
"\\$\\$" + // Header
"\\p{XDigit}{2}" + // Length
@@ -159,7 +163,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..4d17b45fe 100644
--- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
@@ -33,6 +33,10 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Tr20ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
static private Pattern patternPing = Pattern.compile(
"\\%\\%[^,]+,(\\d+)");
@@ -77,7 +81,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..8f495cca8 100644
--- a/src/org/traccar/protocol/TrackboxProtocolDecoder.java
+++ b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
@@ -35,6 +35,10 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public TrackboxProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"(\\d{2})(\\d{2})(\\d{2})\\.(\\d{3})," + // Time
"(\\d{2})(\\d{2}\\.\\d{4})([NS])," + // Latitude (DDMM.MMMM)
@@ -82,7 +86,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..6c8673775 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -35,6 +35,10 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public V680ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"(?:#(\\d+)#" + // IMEI
"([^#]*)#)?" + // User
@@ -80,7 +84,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..70f1ae194 100644
--- a/src/org/traccar/protocol/VisiontekProtocolDecoder.java
+++ b/src/org/traccar/protocol/VisiontekProtocolDecoder.java
@@ -33,6 +33,10 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public VisiontekProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"\\$1," +
"([^,]+)," + // Identifier
@@ -71,7 +75,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..1f14886c4 100644
--- a/src/org/traccar/protocol/WialonProtocolDecoder.java
+++ b/src/org/traccar/protocol/WialonProtocolDecoder.java
@@ -37,6 +37,10 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public WialonProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"(\\d{2})(\\d{2})(\\d{2});" + // Date (DDMMYY)
"(\\d{2})(\\d{2})(\\d{2});" + // Time (HHMMSS)
@@ -71,7 +75,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..6d404a57d 100644
--- a/src/org/traccar/protocol/WondexProtocolDecoder.java
+++ b/src/org/traccar/protocol/WondexProtocolDecoder.java
@@ -33,6 +33,10 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public WondexProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"[^\\d]*" + // Header
"(\\d+)," + // Device Identifier
@@ -65,7 +69,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..bccd8a8cf 100644
--- a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
@@ -33,6 +33,10 @@ public class Xexun2ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Xexun2ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
static private Pattern pattern = Pattern.compile(
"[\r\n]*" +
"(\\d+)," + // Serial
@@ -72,7 +76,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..16573dd7c 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -34,6 +34,10 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public XexunProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"GPRMC," +
"(\\d{2})(\\d{2})(\\d{2}).(\\d+)," + // Time (HHMMSS.SSS)
@@ -62,7 +66,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..2ee0e6b0f 100644
--- a/src/org/traccar/protocol/Xt7ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xt7ProtocolDecoder.java
@@ -35,6 +35,10 @@ public class Xt7ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public Xt7ProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"\\$GPRMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.(\\d+)," + // Time (HHMMSS.SSS)
@@ -67,7 +71,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..01cfbc8dc 100644
--- a/src/org/traccar/protocol/YwtProtocolDecoder.java
+++ b/src/org/traccar/protocol/YwtProtocolDecoder.java
@@ -33,6 +33,10 @@ public class YwtProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
+ public YwtProtocolDecoder(ServerManager serverManager, String protocol) {
+ super(serverManager, protocol);
+ }
+
private static final Pattern pattern = Pattern.compile(
"%(..)," + // Type
"(\\d+):" + // Unit identifier
@@ -81,7 +85,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++);