aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/GenericPipelineFactory.java8
-rw-r--r--src/org/traccar/GenericProtocolDecoder.java46
-rw-r--r--src/org/traccar/GlobalChannelFactory.java7
-rw-r--r--src/org/traccar/GlobalTimer.java44
-rw-r--r--src/org/traccar/Server.java73
-rw-r--r--src/org/traccar/TrackerEventHandler.java17
-rw-r--r--src/org/traccar/TrackerServer.java1
-rw-r--r--src/org/traccar/protocol/Avl08ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/EnforaProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Ev603ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Gl100ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/MaxonProtocolDecoder.java23
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/ProgressProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/ST210ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java20
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java12
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Xexun2ProtocolDecoder.java18
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/Avl08ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/EnforaProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/Ev603ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/Gl100ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/Gps103ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/H02ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/Jt600ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/ST210ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/T55ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/V680ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java2
-rw-r--r--test/org/traccar/protocol/XexunProtocolDecoderTest.java2
39 files changed, 192 insertions, 163 deletions
diff --git a/src/org/traccar/GenericPipelineFactory.java b/src/org/traccar/GenericPipelineFactory.java
index c5e2cc812..d2012753e 100644
--- a/src/org/traccar/GenericPipelineFactory.java
+++ b/src/org/traccar/GenericPipelineFactory.java
@@ -19,6 +19,7 @@ import java.net.InetSocketAddress;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.*;
import org.jboss.netty.handler.logging.LoggingHandler;
+import org.jboss.netty.handler.timeout.IdleStateHandler;
import org.traccar.geocode.ReverseGeocoder;
import org.traccar.helper.Log;
import org.traccar.model.DataManager;
@@ -31,6 +32,7 @@ public abstract class GenericPipelineFactory implements ChannelPipelineFactory {
private TrackerServer server;
private DataManager dataManager;
private Boolean loggerEnabled;
+ private Integer resetDelay;
private ReverseGeocoder geocoder;
/**
@@ -86,10 +88,11 @@ public abstract class GenericPipelineFactory implements ChannelPipelineFactory {
}
public GenericPipelineFactory(
- TrackerServer server, DataManager dataManager, Boolean loggerEnabled, ReverseGeocoder geocoder) {
+ TrackerServer server, DataManager dataManager, Boolean loggerEnabled, Integer resetDelay, ReverseGeocoder geocoder) {
this.server = server;
this.dataManager = dataManager;
this.loggerEnabled = loggerEnabled;
+ this.resetDelay = resetDelay;
this.geocoder = geocoder;
}
@@ -101,6 +104,9 @@ public abstract class GenericPipelineFactory implements ChannelPipelineFactory {
public ChannelPipeline getPipeline() {
ChannelPipeline pipeline = Channels.pipeline();
+ if (resetDelay != 0) {
+ pipeline.addLast("idleHandler", new IdleStateHandler(GlobalTimer.getTimer(), resetDelay, 0, 0));
+ }
pipeline.addLast("openHandler", new OpenChannelHandler(server));
if (loggerEnabled) {
pipeline.addLast("logger", new StandardLoggingHandler());
diff --git a/src/org/traccar/GenericProtocolDecoder.java b/src/org/traccar/GenericProtocolDecoder.java
index b6755f95e..440b37dcb 100644
--- a/src/org/traccar/GenericProtocolDecoder.java
+++ b/src/org/traccar/GenericProtocolDecoder.java
@@ -46,18 +46,6 @@ public abstract class GenericProtocolDecoder extends OneToOneDecoder {
}
/**
- * Reset connection delay
- */
- private Integer resetDelay;
-
- /**
- * Set reset connection delay
- */
- public final void setResetDelay(Integer resetDelay) {
- this.resetDelay = resetDelay;
- }
-
- /**
* Default constructor
*/
public GenericProtocolDecoder() {
@@ -66,40 +54,8 @@ public abstract class GenericProtocolDecoder extends OneToOneDecoder {
/**
* Initialize
*/
- public GenericProtocolDecoder(DataManager dataManager, Integer resetDelay) {
+ public GenericProtocolDecoder(DataManager dataManager) {
setDataManager(dataManager);
- setResetDelay(resetDelay);
- }
-
- /**
- * Disconnect channel
- */
- private class DisconnectTask extends TimerTask {
- private Channel channel;
-
- public DisconnectTask(Channel channel) {
- this.channel = channel;
- }
-
- public void run() {
- channel.disconnect();
- }
- }
-
- /**
- * Handle connect event
- */
- @Override
- public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent evt) throws Exception {
- super.handleUpstream(ctx, evt);
-
- if (evt instanceof ChannelStateEvent) {
- ChannelStateEvent event = (ChannelStateEvent) evt;
-
- if (event.getState() == ChannelState.CONNECTED && event.getValue() != null && resetDelay != 0) {
- new Timer().schedule(new GenericProtocolDecoder.DisconnectTask(evt.getChannel()), resetDelay);
- }
- }
}
}
diff --git a/src/org/traccar/GlobalChannelFactory.java b/src/org/traccar/GlobalChannelFactory.java
index 0c4d11275..a93703286 100644
--- a/src/org/traccar/GlobalChannelFactory.java
+++ b/src/org/traccar/GlobalChannelFactory.java
@@ -28,6 +28,13 @@ public class GlobalChannelFactory {
private GlobalChannelFactory() {
}
+
+ public static void release() {
+ if (instance != null) {
+ instance.releaseExternalResources();
+ }
+ instance = null;
+ }
public static ChannelFactory getFactory() {
if(instance == null) {
diff --git a/src/org/traccar/GlobalTimer.java b/src/org/traccar/GlobalTimer.java
new file mode 100644
index 000000000..b5eea450e
--- /dev/null
+++ b/src/org/traccar/GlobalTimer.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.traccar;
+
+import org.jboss.netty.util.HashedWheelTimer;
+import org.jboss.netty.util.Timer;
+
+/**
+ * Global idle timer
+ */
+public class GlobalTimer {
+
+ private static Timer instance = null;
+
+ private GlobalTimer() {
+ }
+
+ public static void release() {
+ if (instance != null) {
+ instance.stop();
+ }
+ instance = null;
+ }
+
+ public static Timer getTimer() {
+ if(instance == null) {
+ instance = new HashedWheelTimer();
+ }
+ return instance;
+ }
+}
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java
index 0cca284d0..8dd55431f 100644
--- a/src/org/traccar/Server.java
+++ b/src/org/traccar/Server.java
@@ -135,6 +135,11 @@ public class Server {
for (Object server: serverList) {
((TrackerServer) server).stop();
}
+
+ // Release resources
+ GlobalChannelFactory.release();
+ GlobalTimer.release();
+
if (webServer != null) {
webServer.stop();
}
@@ -226,11 +231,11 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new XexunFrameDecoder());
pipeline.addLast("stringDecoder", new StringDecoder());
- pipeline.addLast("objectDecoder", new XexunProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new XexunProtocolDecoder(getDataManager()));
}
});
@@ -249,14 +254,14 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) ';' };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
- pipeline.addLast("objectDecoder", new Gps103ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new Gps103ProtocolDecoder(getDataManager()));
}
});
@@ -275,14 +280,14 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) ')' };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
- pipeline.addLast("objectDecoder", new Tk103ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new Tk103ProtocolDecoder(getDataManager()));
}
});
@@ -301,14 +306,14 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) 0x0 };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
- pipeline.addLast("objectDecoder", new Gl100ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new Gl100ProtocolDecoder(getDataManager()));
}
});
@@ -327,14 +332,14 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) '$' };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
- pipeline.addLast("objectDecoder", new Gl200ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new Gl200ProtocolDecoder(getDataManager()));
}
});
@@ -353,14 +358,14 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) '\r', (byte) '\n' };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
- pipeline.addLast("objectDecoder", new T55ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new T55ProtocolDecoder(getDataManager()));
}
});
@@ -379,13 +384,13 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) '\n' }; // tracker bug \n\r
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
- pipeline.addLast("objectDecoder", new Xexun2ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new Xexun2ProtocolDecoder(getDataManager()));
}
});
@@ -404,13 +409,13 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) '\r', (byte) '\n' };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
- pipeline.addLast("objectDecoder", new Avl08ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new Avl08ProtocolDecoder(getDataManager()));
}
});
@@ -429,10 +434,10 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 0, 2, -2, 2));
- pipeline.addLast("objectDecoder", new EnforaProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new EnforaProtocolDecoder(getDataManager()));
}
});
@@ -451,10 +456,10 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 4));
- pipeline.addLast("objectDecoder", new MeiligaoProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new MeiligaoProtocolDecoder(getDataManager()));
}
});
@@ -469,14 +474,14 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) '\r', (byte) '\n' };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
- pipeline.addLast("objectDecoder", new MaxonProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new MaxonProtocolDecoder(getDataManager()));
}
});
@@ -491,13 +496,13 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) '\r' };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
- pipeline.addLast("objectDecoder", new ST210ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new ST210ProtocolDecoder(getDataManager()));
}
});
@@ -513,10 +518,10 @@ public class Server {
server.setEndianness(java.nio.ByteOrder.LITTLE_ENDIAN);
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, 0, 0));
- pipeline.addLast("objectDecoder", new ProgressProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new ProgressProtocolDecoder(getDataManager()));
}
});
@@ -535,13 +540,13 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) '#' };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
- pipeline.addLast("objectDecoder", new H02ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new H02ProtocolDecoder(getDataManager()));
}
});
@@ -560,10 +565,10 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new Jt600FrameDecoder());
- pipeline.addLast("objectDecoder", new Jt600ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new Jt600ProtocolDecoder(getDataManager()));
}
});
@@ -582,13 +587,13 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) ';' };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
- pipeline.addLast("objectDecoder", new Ev603ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new Ev603ProtocolDecoder(getDataManager()));
}
});
@@ -607,13 +612,13 @@ public class Server {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
- server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), geocoder) {
+ server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
protected void addSpecificHandlers(ChannelPipeline pipeline) {
byte delimiter[] = { (byte) '#', (byte) '#' };
pipeline.addLast("frameDecoder",
new DelimiterBasedFrameDecoder(1024, ChannelBuffers.wrappedBuffer(delimiter)));
pipeline.addLast("stringDecoder", new StringDecoder());
- pipeline.addLast("objectDecoder", new V680ProtocolDecoder(getDataManager(), resetDelay));
+ pipeline.addLast("objectDecoder", new V680ProtocolDecoder(getDataManager()));
}
});
diff --git a/src/org/traccar/TrackerEventHandler.java b/src/org/traccar/TrackerEventHandler.java
index bd3e90160..6483e52e7 100644
--- a/src/org/traccar/TrackerEventHandler.java
+++ b/src/org/traccar/TrackerEventHandler.java
@@ -16,6 +16,8 @@
package org.traccar;
import org.jboss.netty.channel.*;
+import org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler;
+import org.jboss.netty.handler.timeout.IdleStateEvent;
import org.traccar.helper.Log;
import org.traccar.model.DataManager;
import org.traccar.model.Position;
@@ -24,7 +26,7 @@ import org.traccar.model.Position;
* Tracker message handler
*/
@ChannelHandler.Sharable
-public class TrackerEventHandler extends SimpleChannelHandler {
+public class TrackerEventHandler extends IdleStateAwareChannelHandler {
/**
* Data manager
@@ -70,8 +72,21 @@ public class TrackerEventHandler extends SimpleChannelHandler {
}
@Override
+ public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) {
+ Log.info("Closing connection by disconnect");
+ e.getChannel().close();
+ }
+
+ @Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
+ Log.info("Closing connection by exception");
e.getChannel().close();
}
+ @Override
+ public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) {
+ Log.info("Closing connection by timeout");
+ e.getChannel().close();
+ }
+
}
diff --git a/src/org/traccar/TrackerServer.java b/src/org/traccar/TrackerServer.java
index a29386c05..b2e8c0a7f 100644
--- a/src/org/traccar/TrackerServer.java
+++ b/src/org/traccar/TrackerServer.java
@@ -87,7 +87,6 @@ public class TrackerServer extends ServerBootstrap {
public void stop() {
ChannelGroupFuture future = getChannelGroup().close();
future.awaitUninterruptibly();
- getFactory().releaseExternalResources();
}
}
diff --git a/src/org/traccar/protocol/Avl08ProtocolDecoder.java b/src/org/traccar/protocol/Avl08ProtocolDecoder.java
index 2dc711cd7..c8766b642 100644
--- a/src/org/traccar/protocol/Avl08ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl08ProtocolDecoder.java
@@ -33,8 +33,8 @@ public class Avl08ProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public Avl08ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public Avl08ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
diff --git a/src/org/traccar/protocol/EnforaProtocolDecoder.java b/src/org/traccar/protocol/EnforaProtocolDecoder.java
index 3b41592ea..fc40dcbba 100644
--- a/src/org/traccar/protocol/EnforaProtocolDecoder.java
+++ b/src/org/traccar/protocol/EnforaProtocolDecoder.java
@@ -37,8 +37,8 @@ public class EnforaProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public EnforaProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public EnforaProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
diff --git a/src/org/traccar/protocol/Ev603ProtocolDecoder.java b/src/org/traccar/protocol/Ev603ProtocolDecoder.java
index 7730642f4..83689f760 100644
--- a/src/org/traccar/protocol/Ev603ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Ev603ProtocolDecoder.java
@@ -39,8 +39,8 @@ public class Ev603ProtocolDecoder extends GenericProtocolDecoder{
/**
* Initialize
*/
- public Ev603ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public Ev603ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
diff --git a/src/org/traccar/protocol/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
index 8ac68f6f4..2e8b40a61 100644
--- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
@@ -33,8 +33,8 @@ public class Gl100ProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public Gl100ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public Gl100ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 63def5ddf..c109ea4c7 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -33,8 +33,8 @@ public class Gl200ProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public Gl200ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public Gl200ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 6a666fc86..cc0fcb9cb 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -33,8 +33,8 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public Gps103ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public Gps103ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index 183311817..bfdfc3758 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -33,8 +33,8 @@ public class H02ProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public H02ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public H02ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index 11932f8ce..907eabb4b 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -36,8 +36,8 @@ public class Jt600ProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public Jt600ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public Jt600ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
diff --git a/src/org/traccar/protocol/MaxonProtocolDecoder.java b/src/org/traccar/protocol/MaxonProtocolDecoder.java
index 7e26c9c19..e05ef0e30 100644
--- a/src/org/traccar/protocol/MaxonProtocolDecoder.java
+++ b/src/org/traccar/protocol/MaxonProtocolDecoder.java
@@ -42,8 +42,8 @@ public class MaxonProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public MaxonProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public MaxonProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
@@ -51,20 +51,19 @@ public class MaxonProtocolDecoder extends GenericProtocolDecoder {
*/
static private Pattern pattern = Pattern.compile(
"\\$GPRMC," +
- "(\\d{2})(\\d{2})(\\d{2}).(\\d{2})," + // Time (HHMMSS.SSS)
- "([AV])," + // Validity
- "(\\d{2})(\\d{2}.\\d{5})," + // Latitude (DDMM.MMMMM)
+ "(\\d{2})(\\d{2})(\\d{2})\\.(\\d{2})," + // Time (HHMMSS.SSS)
+ "([AV])," + // Validity
+ "(\\d{2})(\\d{2}\\.\\d{5})," + // Latitude (DDMM.MMMMM)
"([NS])," +
- "(\\d{3})(\\d{2}.\\d{5})," + // Longitude (DDDMM.MMMMM)
+ "(\\d{3})(\\d{2}\\.\\d{5})," + // Longitude (DDDMM.MMMMM)
"([EW])," +
- "(\\d+.\\d{3})?," + // Speed
- "(\\d+.\\d{2})?," + // Course
- "(\\d{2})(\\d{2})(\\d{2})" + // Date (DDMMYY)
- ".+"); // Other (Checksumm)
+ "(\\d+\\.\\d{3})?," + // Speed
+ "(\\d+\\.\\d{2})?," + // Course
+ "(\\d{2})(\\d{2})(\\d{2})" + // Date (DDMMYY)
+ ".+"); // Other (Checksumm)
static private Pattern gpfidPattern = Pattern.compile(
- "\\$GPFID,(\\d+)$"
- );
+ "\\$GPFID,(\\d+)$");
/**
* Decode message"
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 388565207..27defde78 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -38,8 +38,8 @@ public class MeiligaoProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public MeiligaoProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public MeiligaoProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
@@ -55,7 +55,7 @@ public class MeiligaoProtocolDecoder extends GenericProtocolDecoder {
"(\\d+.\\d+)," + // Speed
"(\\d+\\.?\\d+)?," + // Course
"(\\d{2})(\\d{2})(\\d{2})," + // Date (DDMMYY)
- "[^\\|]+\\|(\\d+.\\d)\\|" + // Dilution of precision
+ "[^\\|]+\\|(\\d+\\.\\d)\\|" + // Dilution of precision
"(\\d+)\\|" + // Altitude
"([0-9a-fA-F]+)\\|" + // State
".*"); // TODO: parse ADC
diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java
index 173dd083a..865e190e2 100644
--- a/src/org/traccar/protocol/ProgressProtocolDecoder.java
+++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java
@@ -39,8 +39,8 @@ public class ProgressProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public ProgressProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public ProgressProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/*
diff --git a/src/org/traccar/protocol/ST210ProtocolDecoder.java b/src/org/traccar/protocol/ST210ProtocolDecoder.java
index 9418293fc..642079361 100644
--- a/src/org/traccar/protocol/ST210ProtocolDecoder.java
+++ b/src/org/traccar/protocol/ST210ProtocolDecoder.java
@@ -1,13 +1,11 @@
package org.traccar.protocol;
import java.util.Calendar;
-import java.util.GregorianCalendar;
import java.util.LinkedList;
import java.util.List;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.GenericProtocolDecoder;
@@ -18,8 +16,8 @@ import org.traccar.model.Position;
public class ST210ProtocolDecoder extends GenericProtocolDecoder {
- public ST210ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public ST210ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
private enum ST210FIELDS {
diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java
index 9342433b7..d531f1adf 100644
--- a/src/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/org/traccar/protocol/T55ProtocolDecoder.java
@@ -38,8 +38,8 @@ public class T55ProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public T55ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public T55ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
@@ -47,16 +47,16 @@ public class T55ProtocolDecoder extends GenericProtocolDecoder {
*/
static private Pattern pattern = Pattern.compile(
"\\$GPRMC," +
- "(\\d{2})(\\d{2})(\\d{2}).(\\d{3})," + // Time (HHMMSS.SSS)
- "([AV])," + // Validity
- "(\\d{2})(\\d{2}.\\d{4})," + // Latitude (DDMM.MMMM)
+ "(\\d{2})(\\d{2})(\\d{2})\\.(\\d{3})," + // Time (HHMMSS.SSS)
+ "([AV])," + // Validity
+ "(\\d{2})(\\d{2}\\.\\d{4})," + // Latitude (DDMM.MMMM)
"([NS])," +
- "(\\d{3})(\\d{2}.\\d{4})," + // Longitude (DDDMM.MMMM)
+ "(\\d{3})(\\d{2}\\.\\d{4})," + // Longitude (DDDMM.MMMM)
"([EW])," +
- "(\\d+.\\d{2})?," + // Speed
- "(\\d+.\\d{2})?," + // Course
- "(\\d{2})(\\d{2})(\\d{2})" + // Date (DDMMYY)
- ".+"); // Other (Checksumm)
+ "(\\d+\\.\\d{2})?," + // Speed
+ "(\\d+\\.\\d{2})?," + // Course
+ "(\\d{2})(\\d{2})(\\d{2})" + // Date (DDMMYY)
+ ".+"); // Other (Checksumm)
/**
* Decode message
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index a0129dd5a..4c0fd0c03 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -33,8 +33,8 @@ public class Tk103ProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public Tk103ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public Tk103ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
@@ -47,13 +47,13 @@ public class Tk103ProtocolDecoder extends GenericProtocolDecoder {
"(\\d{15})" + // IMEI (?)
"(\\d{2})(\\d{2})(\\d{2})" + // Date (YYMMDD)
"([AV])" + // Validity
- "(\\d{2})(\\d{2}.\\d{4})" + // Latitude (DDMM.MMMM)
+ "(\\d{2})(\\d{2}\\.\\d{4})" + // Latitude (DDMM.MMMM)
"([NS])" +
- "(\\d{3})(\\d{2}.\\d{4})" + // Longitude (DDDMM.MMMM)
+ "(\\d{3})(\\d{2}\\.\\d{4})" + // Longitude (DDDMM.MMMM)
"([EW])" +
- "(\\d+.\\d)" + // Speed
+ "(\\d+\\.\\d)" + // Speed
"(\\d{2})(\\d{2})(\\d{2})" + // Time (HHMMSS)
- "(\\d+.\\d{2})" + // Course
+ "(\\d+\\.\\d{2})" + // Course
"(\\d+)" + // State
".+"); // Mileage (?)
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index 5d2427ca4..10f17b184 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -33,8 +33,8 @@ public class V680ProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public V680ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public V680ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
diff --git a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
index 1ee2737d1..e7b29b728 100644
--- a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
@@ -33,8 +33,8 @@ public class Xexun2ProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public Xexun2ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public Xexun2ProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
@@ -45,14 +45,14 @@ public class Xexun2ProtocolDecoder extends GenericProtocolDecoder {
"(\\d+)," + // Serial
"(\\+\\d+)," + // Number
"GPRMC," +
- "(\\d{2})(\\d{2})(\\d{2}).(\\d{3})," + // Time (HHMMSS.SSS)
+ "(\\d{2})(\\d{2})(\\d{2})\\.(\\d{3})," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
- "(\\d{2})(\\d{2}.\\d{4})," + // Latitude (DDMM.MMMM)
+ "(\\d{2})(\\d{2}\\.\\d{4})," + // Latitude (DDMM.MMMM)
"([NS])," +
- "(\\d{3})(\\d{2}.\\d{4})," + // Longitude (DDDMM.MMMM)
+ "(\\d{3})(\\d{2}\\.\\d{4})," + // Longitude (DDDMM.MMMM)
"([EW])," +
- "(\\d+.\\d+)," + // Speed
- "(\\d+.\\d+)?," + // Course
+ "(\\d+\\.\\d+)," + // Speed
+ "(\\d+\\.\\d+)?," + // Course
"(\\d{2})(\\d{2})(\\d{2})," + // Date (DDMMYY)
",,.\\*..," + // Checksum
"([FL])," + // Signal
@@ -60,8 +60,8 @@ public class Xexun2ProtocolDecoder extends GenericProtocolDecoder {
".*imei:" +
"(\\d+)," + // IMEI
"(\\d+)," + // Satellites
- "(\\d+.\\d+)," + // Altitude
- "F:(\\d+.\\d+)V," + // Power
+ "(\\d+\\.\\d+)," + // Altitude
+ "F:(\\d+\\.\\d+)V," + // Power
".*" +
"[\r\n]*");
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index f6b7bcb44..cbff2dee3 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -34,8 +34,8 @@ public class XexunProtocolDecoder extends GenericProtocolDecoder {
/**
* Initialize
*/
- public XexunProtocolDecoder(DataManager dataManager, Integer resetDelay) {
- super(dataManager, resetDelay);
+ public XexunProtocolDecoder(DataManager dataManager) {
+ super(dataManager);
}
/**
diff --git a/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java b/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java
index 8145412a5..5e0004444 100644
--- a/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class Avl08ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- Avl08ProtocolDecoder decoder = new Avl08ProtocolDecoder(new TestDataManager(), 0);
+ Avl08ProtocolDecoder decoder = new Avl08ProtocolDecoder(new TestDataManager());
assertNull(decoder.decode(null, null,
"$$AE359772033395899|AA000000000000000000000000000000000000000000000000000000000000|00.0|00.0|00.0|000000000000|20090215000153|13601435|00000000|00000000|0000|0.0000|0007|2DAA"));
diff --git a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java
index 06e8155ae..bf7f22290 100644
--- a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java
@@ -11,7 +11,7 @@ public class EnforaProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- EnforaProtocolDecoder decoder = new EnforaProtocolDecoder(new TestDataManager(), 0);
+ EnforaProtocolDecoder decoder = new EnforaProtocolDecoder(new TestDataManager());
ChannelBufferFactory factory = new HeapChannelBufferFactory();
byte[] buf1 = {0x00,0x0A,0x08,0x00,0x20,0x20,0x20,0x20,0x20,0x30,0x31,0x31,0x30,0x37,0x30,0x30,0x30,0x30,0x35,0x37,0x30,0x32,0x36,0x37};
diff --git a/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java b/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java
index 32aaa8ea7..c25c06798 100644
--- a/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Ev603ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class Ev603ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- Ev603ProtocolDecoder decoder = new Ev603ProtocolDecoder(new TestDataManager(), 0);
+ Ev603ProtocolDecoder decoder = new Ev603ProtocolDecoder(new TestDataManager());
assertNull(decoder.decode(null, null, "!5,17,V"));
diff --git a/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java
index 1e1a1c978..e066d9af8 100644
--- a/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Gl100ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- Gl100ProtocolDecoder decoder = new Gl100ProtocolDecoder(new TestDataManager(), 0);
+ Gl100ProtocolDecoder decoder = new Gl100ProtocolDecoder(new TestDataManager());
assertNotNull(decoder.decode(null, null,
"+RESP:GTSOS,359231030000010,0,0,0,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,11F0,0102120204"));
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index 80d5c8377..3be9bdc35 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Gl200ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new TestDataManager(), 0);
+ Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new TestDataManager());
assertNotNull(decoder.decode(null, null,
"+RESP:GTFRI,020102,000035988863964,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,,20090214093254,11F0"));
diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index 384708cc9..427d4afb4 100644
--- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class Gps103ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new TestDataManager(), 0);
+ Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new TestDataManager());
// Log on request
//assertNull(decoder.decode(null, null, "##,imei:359586015829802,A"));
diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
index 25920e8dd..cd200705b 100644
--- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class H02ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- H02ProtocolDecoder decoder = new H02ProtocolDecoder(new TestDataManager(), 0);
+ H02ProtocolDecoder decoder = new H02ProtocolDecoder(new TestDataManager());
assertNotNull(decoder.decode(null, null,
"*HQ,123456789012345,V1,155850,A,5214.5346,N,2117.4683,E,0.00,270.90,131012,ffffffff,000000,000000,000000,000000"));
diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
index c08ca0605..3e214832e 100644
--- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
@@ -10,7 +10,7 @@ public class Jt600ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(new TestDataManager(), 0);
+ Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(new TestDataManager());
byte[] buf1 = {0x24,0x31,0x10,0x21,0x60,0x01,0x11,0x00,0x1B,0x16,0x02,0x11,0x05,0x59,0x10,0x22,0x32,(byte)0x98,0x62,0x11,0x40,0x46,0x22,0x7B,0x05,(byte)0x98,0x09,0x50,(byte)0x80,0x01,0x23,0x27,(byte)0x95,0x14,0x35,0x16,0x1F};
assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1)));
diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
index 7a0fcc3d0..8379909df 100644
--- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
@@ -11,7 +11,7 @@ public class MeiligaoProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(new TestDataManager(), 0);
+ MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(new TestDataManager());
ChannelBufferFactory factory = new HeapChannelBufferFactory();
byte[] buf1 = {0x12,0x34,0x56,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,0x50,0x00,(byte)0x8B,(byte)0x9B,0x0D,0x0A};
diff --git a/test/org/traccar/protocol/ST210ProtocolDecoderTest.java b/test/org/traccar/protocol/ST210ProtocolDecoderTest.java
index 0a1b11e67..7956c3dd4 100644
--- a/test/org/traccar/protocol/ST210ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/ST210ProtocolDecoderTest.java
@@ -11,7 +11,7 @@ public class ST210ProtocolDecoderTest {
public void testDecode() throws Exception {
ST210ProtocolDecoder decoder = new ST210ProtocolDecoder(
- new TestDataManager(), 0);
+ new TestDataManager());
//Status
assertNotNull(decoder
diff --git a/test/org/traccar/protocol/T55ProtocolDecoderTest.java b/test/org/traccar/protocol/T55ProtocolDecoderTest.java
index 678549968..5d9ae4e3a 100644
--- a/test/org/traccar/protocol/T55ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/T55ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class T55ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- T55ProtocolDecoder decoder = new T55ProtocolDecoder(new TestDataManager(), 0);
+ T55ProtocolDecoder decoder = new T55ProtocolDecoder(new TestDataManager());
assertNull(decoder.decode(null, null, "$PGID,359853000144328*0F"));
diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
index 9d77d4dc2..d7e9b2444 100644
--- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
@@ -9,7 +9,7 @@ public class Tk103ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new TestDataManager(), 0);
+ Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new TestDataManager());
assertNull(decoder.decode(null, null, "(090411121854BP0000001234567890HSO"));
diff --git a/test/org/traccar/protocol/V680ProtocolDecoderTest.java b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
index ef0f5f403..15b25b9d9 100644
--- a/test/org/traccar/protocol/V680ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class V680ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- V680ProtocolDecoder decoder = new V680ProtocolDecoder(new TestDataManager(), 0);
+ V680ProtocolDecoder decoder = new V680ProtocolDecoder(new TestDataManager());
assertNotNull(decoder.decode(null, null,
"#356823033219838#1000#0#1478#AUT#1#66830FFB#03855.6628,E,4716.6821,N,001.41,259#130812#143905"));
diff --git a/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java b/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java
index 817c31874..8a31334da 100644
--- a/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Xexun2ProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class Xexun2ProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- Xexun2ProtocolDecoder decoder = new Xexun2ProtocolDecoder(new TestDataManager(), 0);
+ Xexun2ProtocolDecoder decoder = new Xexun2ProtocolDecoder(new TestDataManager());
assertNotNull(decoder.decode(null, null,
"111111120009,+436763737552,GPRMC,120009.590,A,4639.6774,N,01418.5737,E,0.00,0.00,111111,,,A*68,F,, imei:359853000144328,04,481.2,F:4.15V,0,139,2689,232,03,2725,0576"));
diff --git a/test/org/traccar/protocol/XexunProtocolDecoderTest.java b/test/org/traccar/protocol/XexunProtocolDecoderTest.java
index f85ce9bb3..2d12110a2 100644
--- a/test/org/traccar/protocol/XexunProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/XexunProtocolDecoderTest.java
@@ -8,7 +8,7 @@ public class XexunProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
- XexunProtocolDecoder decoder = new XexunProtocolDecoder(new TestDataManager(), 0);
+ XexunProtocolDecoder decoder = new XexunProtocolDecoder(new TestDataManager());
assertNotNull(decoder.decode(null, null,
"GPRMC,150120.000,A,3346.4463,S,15057.3083,E,0.0,117.4,010911,,,A*76,F,imei:351525010943661,"));