diff options
author | Abyss777 <abyss@fox5.ru> | 2017-08-14 14:43:17 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-08-14 15:37:59 +0500 |
commit | 8313471a752dc08e5e7a270349e9f03417672b08 (patch) | |
tree | ac124a5eb3009826a53c6b57342a9719716081f7 /src/org/traccar/events/MotionEventHandler.java | |
parent | 30e8409375f9992a5248f7e2597691c0ee08188c (diff) | |
download | trackermap-server-8313471a752dc08e5e7a270349e9f03417672b08.tar.gz trackermap-server-8313471a752dc08e5e7a270349e9f03417672b08.tar.bz2 trackermap-server-8313471a752dc08e5e7a270349e9f03417672b08.zip |
Correct motion state by ignition.
Diffstat (limited to 'src/org/traccar/events/MotionEventHandler.java')
-rw-r--r-- | src/org/traccar/events/MotionEventHandler.java | 8 |
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..208fd5b42 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.getStopOnIgnitionOff() + && 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); } } |