diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2011-05-05 06:28:25 +0000 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2011-05-05 06:28:25 +0000 |
commit | d673fa357b64ffa34209465a535d00983cba5576 (patch) | |
tree | bff99c61fdf368a915adb336f1d1b173d99b6197 /src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java | |
parent | dd6db81db43f5c23e5349c0b06d4a0ce6830d127 (diff) | |
download | trackermap-server-d673fa357b64ffa34209465a535d00983cba5576.tar.gz trackermap-server-d673fa357b64ffa34209465a535d00983cba5576.tar.bz2 trackermap-server-d673fa357b64ffa34209465a535d00983cba5576.zip |
Diffstat (limited to 'src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java')
-rw-r--r-- | src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java | 15 |
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); } } - } } |