aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/MotionEventHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-08-14 23:42:41 +1200
committerGitHub <noreply@github.com>2017-08-14 23:42:41 +1200
commit52d19ba205d76d18d62789fbb013a43fef024e91 (patch)
tree70118d6bb9c4894d043d46c32cc4558f6a00bbd3 /src/org/traccar/events/MotionEventHandler.java
parent30e8409375f9992a5248f7e2597691c0ee08188c (diff)
parentfdc14dd2a286b7d9470ff97703d120c217a39dcb (diff)
downloadtrackermap-server-52d19ba205d76d18d62789fbb013a43fef024e91.tar.gz
trackermap-server-52d19ba205d76d18d62789fbb013a43fef024e91.tar.bz2
trackermap-server-52d19ba205d76d18d62789fbb013a43fef024e91.zip
Merge pull request #3443 from Abyss777/stop_on_ignition_off
Correct stop state by ignition.
Diffstat (limited to 'src/org/traccar/events/MotionEventHandler.java')
-rw-r--r--src/org/traccar/events/MotionEventHandler.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/org/traccar/events/MotionEventHandler.java b/src/org/traccar/events/MotionEventHandler.java
index b20a11999..8c2d4c56c 100644
--- a/src/org/traccar/events/MotionEventHandler.java
+++ b/src/org/traccar/events/MotionEventHandler.java
@@ -78,13 +78,19 @@ public class MotionEventHandler extends BaseEventHandler {
if (motionPosition != null) {
long motionTime = motionPosition.getFixTime().getTime();
double distance = ReportUtils.calculateDistance(motionPosition, position, false);
+ Boolean ignition = null;
+ if (tripsConfig.getUseIgnition()
+ && position.getAttributes().containsKey(Position.KEY_IGNITION)) {
+ ignition = position.getBoolean(Position.KEY_IGNITION);
+ }
if (newMotion) {
if (motionTime + tripsConfig.getMinimalTripDuration() <= currentTime
|| distance >= tripsConfig.getMinimalTripDistance()) {
result = newEvent(deviceState, newMotion);
}
} else {
- if (motionTime + tripsConfig.getMinimalParkingDuration() <= currentTime) {
+ if (motionTime + tripsConfig.getMinimalParkingDuration() <= currentTime
+ || ignition != null && !ignition) {
result = newEvent(deviceState, newMotion);
}
}