aboutsummaryrefslogtreecommitdiff
path: root/src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java')
-rw-r--r--src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java b/src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java
index 63e904600..663ca22bb 100644
--- a/src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java
+++ b/src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java
@@ -44,10 +44,16 @@ public class Gps103ProtocolDecoder extends OneToOneDecoder {
private DataManager dataManager;
/**
+ * Reset connection delay
+ */
+ private Integer resetDelay;
+
+ /**
* Init device table
*/
- public Gps103ProtocolDecoder(DataManager newDataManager) {
- dataManager = newDataManager;
+ public Gps103ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
+ this.dataManager = dataManager;
+ this.resetDelay = resetDelay;
}
/**
@@ -152,11 +158,10 @@ public class Gps103ProtocolDecoder extends OneToOneDecoder {
if (evt instanceof ChannelStateEvent) {
ChannelStateEvent event = (ChannelStateEvent) evt;
- if (event.getState() == ChannelState.CONNECTED && event.getValue() != null) {
- new Timer().schedule(new DisconnectTask(evt.getChannel()) , 5 * 60 * 1000);
+ if (event.getState() == ChannelState.CONNECTED && event.getValue() != null && resetDelay != 0) {
+ new Timer().schedule(new DisconnectTask(evt.getChannel()), resetDelay);
}
}
-
}
}