aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-03-23 10:21:25 +0500
committerAbyss777 <abyss@fox5.ru>2017-03-23 10:21:25 +0500
commitff9f34d6e685119c5d85d705d6cbd4f29149eee0 (patch)
tree26dcf9a51e267547d9275136dc6af1333fefa1ce
parentce809d8f053360bd820cf05175101b92a40b8109 (diff)
downloadtraccar-server-ff9f34d6e685119c5d85d705d6cbd4f29149eee0.tar.gz
traccar-server-ff9f34d6e685119c5d85d705d6cbd4f29149eee0.tar.bz2
traccar-server-ff9f34d6e685119c5d85d705d6cbd4f29149eee0.zip
Move default device status to getter
-rw-r--r--src/org/traccar/database/DeviceManager.java1
-rw-r--r--src/org/traccar/model/Device.java8
2 files changed, 2 insertions, 7 deletions
diff --git a/src/org/traccar/database/DeviceManager.java b/src/org/traccar/database/DeviceManager.java
index ae5784b01..68e2e8262 100644
--- a/src/org/traccar/database/DeviceManager.java
+++ b/src/org/traccar/database/DeviceManager.java
@@ -131,7 +131,6 @@ public class DeviceManager implements IdentityManager {
device.setGeofenceIds(geofenceManager.getCurrentDeviceGeofences(lastPosition));
}
}
- device.setStatus(Device.STATUS_OFFLINE);
}
}
for (Iterator<Long> iterator = devicesById.keySet().iterator(); iterator.hasNext();) {
diff --git a/src/org/traccar/model/Device.java b/src/org/traccar/model/Device.java
index 4c02481ca..2324da532 100644
--- a/src/org/traccar/model/Device.java
+++ b/src/org/traccar/model/Device.java
@@ -47,15 +47,11 @@ public class Device extends Extensible {
private String status;
public String getStatus() {
- return status;
+ return status != null ? status : STATUS_OFFLINE;
}
public void setStatus(String status) {
- if (STATUS_ONLINE.equals(status) || STATUS_UNKNOWN.equals(status)) {
- this.status = status;
- } else {
- this.status = STATUS_OFFLINE;
- }
+ this.status = status;
}
private Date lastUpdate;