diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-22 06:28:00 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-22 06:28:00 +1300 |
commit | d08857e6c87d41eba835f16035e2da9159de9e49 (patch) | |
tree | 771662499c4793b7649caf7270a3a126a6cebeb8 /src/org/traccar/database/ConnectionManager.java | |
parent | 82f51b570a0957587b25b48fdb5cfd21c4b14e9d (diff) | |
download | trackermap-server-d08857e6c87d41eba835f16035e2da9159de9e49.tar.gz trackermap-server-d08857e6c87d41eba835f16035e2da9159de9e49.tar.bz2 trackermap-server-d08857e6c87d41eba835f16035e2da9159de9e49.zip |
Implement unknown status event
Diffstat (limited to 'src/org/traccar/database/ConnectionManager.java')
-rw-r--r-- | src/org/traccar/database/ConnectionManager.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/org/traccar/database/ConnectionManager.java b/src/org/traccar/database/ConnectionManager.java index 216c90bc2..bc44c31ae 100644 --- a/src/org/traccar/database/ConnectionManager.java +++ b/src/org/traccar/database/ConnectionManager.java @@ -76,10 +76,19 @@ public class ConnectionManager { } if (enableStatusEvents && !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); + String eventType; + switch (status) { + case Device.STATUS_ONLINE: + eventType = Event.TYPE_DEVICE_ONLINE; + break; + case Device.STATUS_UNKNOWN: + eventType = Event.TYPE_DEVICE_UNKNOWN; + break; + default: + eventType = Event.TYPE_DEVICE_OFFLINE; + break; } + Event event = new Event(eventType, deviceId); if (Context.getNotificationManager() != null) { Context.getNotificationManager().updateEvent(event, null); } @@ -91,7 +100,6 @@ public class ConnectionManager { timeout.cancel(); } - if (time != null) { device.setLastUpdate(time); } |