diff options
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); } |