diff options
author | Abyss777 <abyss@fox5.ru> | 2016-10-03 12:16:15 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-10-03 12:16:15 +0500 |
commit | bae6692356872fcc093ce92ed37cba7d2e2f6d7f (patch) | |
tree | 40f33a5425b098fc0cb6ec717006b919463d3c47 /src/org/traccar/database/ConnectionManager.java | |
parent | 4a550477eb3411894f8e12e0b2bded8051b34d07 (diff) | |
download | trackermap-server-bae6692356872fcc093ce92ed37cba7d2e2f6d7f.tar.gz trackermap-server-bae6692356872fcc093ce92ed37cba7d2e2f6d7f.tar.bz2 trackermap-server-bae6692356872fcc093ce92ed37cba7d2e2f6d7f.zip |
Make status events switchable
Diffstat (limited to 'src/org/traccar/database/ConnectionManager.java')
-rw-r--r-- | src/org/traccar/database/ConnectionManager.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/org/traccar/database/ConnectionManager.java b/src/org/traccar/database/ConnectionManager.java index 46ccab81e..b12899711 100644 --- a/src/org/traccar/database/ConnectionManager.java +++ b/src/org/traccar/database/ConnectionManager.java @@ -40,6 +40,7 @@ public class ConnectionManager { private static final long DEFAULT_TIMEOUT = 600; private final long deviceTimeout; + private final boolean statusHandler; private final Map<Long, ActiveDevice> activeDevices = new HashMap<>(); private final Map<Long, Set<UpdateListener>> listeners = new HashMap<>(); @@ -47,6 +48,7 @@ public class ConnectionManager { public ConnectionManager() { deviceTimeout = Context.getConfig().getLong("status.timeout", DEFAULT_TIMEOUT) * 1000; + statusHandler = Context.getConfig().getBoolean("event.statusHandler"); } public void addActiveDevice(long deviceId, Protocol protocol, Channel channel, SocketAddress remoteAddress) { @@ -73,7 +75,7 @@ public class ConnectionManager { return; } - if (!status.equals(device.getStatus())) { + if (statusHandler && !status.equals(device.getStatus())) { Event event = new Event(Event.TYPE_DEVICE_OFFLINE, deviceId); if (status.equals(Device.STATUS_ONLINE)) { event.setType(Event.TYPE_DEVICE_ONLINE); |