aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/MotionEventHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-08-15 11:19:11 +0300
committerGitHub <noreply@github.com>2016-08-15 11:19:11 +0300
commit70bea1304ded17bb8a94ce8495d1e395e7cdf748 (patch)
tree7634388ffd859f23d1703481dd65402a361185d6 /src/org/traccar/events/MotionEventHandler.java
parent8030d39ca0522bc8be69e017fa9fc06900d1a7bc (diff)
parent807ce3b00210b96c68727ce675400a5205dcf4a1 (diff)
downloadtrackermap-server-70bea1304ded17bb8a94ce8495d1e395e7cdf748.tar.gz
trackermap-server-70bea1304ded17bb8a94ce8495d1e395e7cdf748.tar.bz2
trackermap-server-70bea1304ded17bb8a94ce8495d1e395e7cdf748.zip
Merge pull request #2215 from Abyss777/speed_threshold
Made speed threshold configurable
Diffstat (limited to 'src/org/traccar/events/MotionEventHandler.java')
-rw-r--r--src/org/traccar/events/MotionEventHandler.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/org/traccar/events/MotionEventHandler.java b/src/org/traccar/events/MotionEventHandler.java
index 7178f7036..33c7735cd 100644
--- a/src/org/traccar/events/MotionEventHandler.java
+++ b/src/org/traccar/events/MotionEventHandler.java
@@ -26,7 +26,11 @@ import org.traccar.model.Position;
public class MotionEventHandler extends BaseEventHandler {
- private static final double SPEED_THRESHOLD = 0.01;
+ private double speedThreshold;
+
+ public MotionEventHandler() {
+ speedThreshold = Context.getConfig().getDouble("event.motion.speedThreshold", 0.01);
+ }
@Override
protected Collection<Event> analyzePosition(Position position) {
@@ -46,10 +50,10 @@ public class MotionEventHandler extends BaseEventHandler {
if (lastPosition != null) {
oldSpeed = lastPosition.getSpeed();
}
- if (speed > SPEED_THRESHOLD && oldSpeed <= SPEED_THRESHOLD) {
+ if (speed > speedThreshold && oldSpeed <= speedThreshold) {
result = new ArrayList<>();
result.add(new Event(Event.TYPE_DEVICE_MOVING, position.getDeviceId(), position.getId()));
- } else if (speed <= SPEED_THRESHOLD && oldSpeed > SPEED_THRESHOLD) {
+ } else if (speed <= speedThreshold && oldSpeed > speedThreshold) {
result = new ArrayList<>();
result.add(new Event(Event.TYPE_DEVICE_STOPPED, position.getDeviceId(), position.getId()));
}