aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/FuelDropEventHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/events/FuelDropEventHandler.java')
-rw-r--r--src/org/traccar/events/FuelDropEventHandler.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/org/traccar/events/FuelDropEventHandler.java b/src/org/traccar/events/FuelDropEventHandler.java
index e9a261aea..2ee3e1a58 100644
--- a/src/org/traccar/events/FuelDropEventHandler.java
+++ b/src/org/traccar/events/FuelDropEventHandler.java
@@ -21,21 +21,21 @@ import org.traccar.model.Device;
import org.traccar.model.Event;
import org.traccar.model.Position;
-import java.util.Collection;
import java.util.Collections;
+import java.util.Map;
public class FuelDropEventHandler extends BaseEventHandler {
public static final String ATTRIBUTE_FUEL_DROP_THRESHOLD = "fuelDropThreshold";
@Override
- protected Collection<Event> analyzePosition(Position position) {
+ protected Map<Event, Position> analyzePosition(Position position) {
- Device device = Context.getIdentityManager().getDeviceById(position.getDeviceId());
+ Device device = Context.getIdentityManager().getById(position.getDeviceId());
if (device == null) {
return null;
}
- if (!Context.getIdentityManager().isLatestPosition(position) || !position.getValid()) {
+ if (!Context.getIdentityManager().isLatestPosition(position)) {
return null;
}
@@ -52,7 +52,7 @@ public class FuelDropEventHandler extends BaseEventHandler {
if (drop >= fuelDropThreshold) {
Event event = new Event(Event.TYPE_DEVICE_FUEL_DROP, position.getDeviceId(), position.getId());
event.set(ATTRIBUTE_FUEL_DROP_THRESHOLD, fuelDropThreshold);
- return Collections.singleton(event);
+ return Collections.singletonMap(event, position);
}
}
}