diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/Context.java | 3 | ||||
-rw-r--r-- | src/org/traccar/events/FuelDropEventHandler.java | 2 | ||||
-rw-r--r-- | src/org/traccar/events/MotionEventHandler.java | 3 | ||||
-rw-r--r-- | src/org/traccar/reports/model/TripsConfig.java | 13 |
4 files changed, 17 insertions, 4 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java index 340eb742c..cf857178f 100644 --- a/src/org/traccar/Context.java +++ b/src/org/traccar/Context.java @@ -258,7 +258,8 @@ public final class Context { config.getLong("report.trip.minimalTripDuration", 300) * 1000, config.getLong("report.trip.minimalParkingDuration", 300) * 1000, config.getLong("report.trip.minimalNoDataDuration", 3600) * 1000, - config.getBoolean("report.trip.useIgnition")); + config.getBoolean("report.trip.useIgnition"), + config.getBoolean("event.motion.processInvalidPositions")); } public static void init(String[] arguments) throws Exception { diff --git a/src/org/traccar/events/FuelDropEventHandler.java b/src/org/traccar/events/FuelDropEventHandler.java index 4fc512162..2ee3e1a58 100644 --- a/src/org/traccar/events/FuelDropEventHandler.java +++ b/src/org/traccar/events/FuelDropEventHandler.java @@ -35,7 +35,7 @@ public class FuelDropEventHandler extends BaseEventHandler { if (device == null) { return null; } - if (!Context.getIdentityManager().isLatestPosition(position) || !position.getValid()) { + if (!Context.getIdentityManager().isLatestPosition(position)) { return null; } diff --git a/src/org/traccar/events/MotionEventHandler.java b/src/org/traccar/events/MotionEventHandler.java index ae64c10ea..0c1c4848f 100644 --- a/src/org/traccar/events/MotionEventHandler.java +++ b/src/org/traccar/events/MotionEventHandler.java @@ -109,7 +109,8 @@ public class MotionEventHandler extends BaseEventHandler { if (device == null) { return null; } - if (!Context.getIdentityManager().isLatestPosition(position) || !position.getValid()) { + if (!Context.getIdentityManager().isLatestPosition(position) + || !tripsConfig.getProcessInvalidPositions() && !position.getValid()) { return null; } diff --git a/src/org/traccar/reports/model/TripsConfig.java b/src/org/traccar/reports/model/TripsConfig.java index 22fddd072..ca361a466 100644 --- a/src/org/traccar/reports/model/TripsConfig.java +++ b/src/org/traccar/reports/model/TripsConfig.java @@ -22,12 +22,13 @@ public class TripsConfig { } public TripsConfig(double minimalTripDistance, long minimalTripDuration, long minimalParkingDuration, - long minimalNoDataDuration, boolean useIgnition) { + long minimalNoDataDuration, boolean useIgnition, boolean processInvalidPositions) { this.minimalTripDistance = minimalTripDistance; this.minimalTripDuration = minimalTripDuration; this.minimalParkingDuration = minimalParkingDuration; this.minimalNoDataDuration = minimalNoDataDuration; this.useIgnition = useIgnition; + this.processInvalidPositions = processInvalidPositions; } private double minimalTripDistance; @@ -80,4 +81,14 @@ public class TripsConfig { this.useIgnition = useIgnition; } + private boolean processInvalidPositions; + + public boolean getProcessInvalidPositions() { + return processInvalidPositions; + } + + public void setProcessInvalidPositions(boolean processInvalidPositions) { + this.processInvalidPositions = processInvalidPositions; + } + } |