aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/events')
-rw-r--r--src/org/traccar/events/GeofenceEventHandler.java10
-rw-r--r--src/org/traccar/events/MotionEventHandler.java5
2 files changed, 6 insertions, 9 deletions
diff --git a/src/org/traccar/events/GeofenceEventHandler.java b/src/org/traccar/events/GeofenceEventHandler.java
index ed63b6f7d..56029fced 100644
--- a/src/org/traccar/events/GeofenceEventHandler.java
+++ b/src/org/traccar/events/GeofenceEventHandler.java
@@ -10,7 +10,6 @@ import org.traccar.Context;
import org.traccar.database.DataManager;
import org.traccar.database.GeofenceManager;
import org.traccar.helper.Log;
-import org.traccar.model.Device;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -32,21 +31,20 @@ public class GeofenceEventHandler extends BaseEventHandler {
return null;
}
- Device device = dataManager.getDeviceById(position.getDeviceId());
- if (device == null) {
+ if (getDevice() == null) {
return null;
}
List<Long> currentGeofences = geofenceManager.getCurrentDeviceGeofences(position);
List<Long> oldGeofences = new ArrayList<Long>();
- if (device.getGeofenceIds() != null) {
- oldGeofences.addAll(device.getGeofenceIds());
+ if (getDevice().getGeofenceIds() != null) {
+ oldGeofences.addAll(getDevice().getGeofenceIds());
}
List<Long> newGeofences = new ArrayList<Long>(currentGeofences);
newGeofences.removeAll(oldGeofences);
oldGeofences.removeAll(currentGeofences);
- device.setGeofenceIds(currentGeofences);
+ getDevice().setGeofenceIds(currentGeofences);
Collection<Event> events = new ArrayList<>();
try {
diff --git a/src/org/traccar/events/MotionEventHandler.java b/src/org/traccar/events/MotionEventHandler.java
index 54b6b922d..2ba5979e3 100644
--- a/src/org/traccar/events/MotionEventHandler.java
+++ b/src/org/traccar/events/MotionEventHandler.java
@@ -29,11 +29,10 @@ public class MotionEventHandler extends BaseEventHandler {
double speed = position.getSpeed();
boolean valid = position.getValid();
- Device device = Context.getIdentityManager().getDeviceById(position.getDeviceId());
- if (device == null) {
+ if (getDevice() == null) {
return null;
}
- String motion = device.getMotion();
+ String motion = getDevice().getMotion();
if (motion == null) {
motion = Device.STATUS_STOPPED;
}