From f54ec00be2611c274e442cd6b2fd5ccdcf433ae5 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 28 Dec 2020 11:06:25 -0800 Subject: Migrate more config keys --- src/main/java/org/traccar/config/Config.java | 12 +++++------- src/main/java/org/traccar/config/Keys.java | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'src/main/java/org/traccar/config') diff --git a/src/main/java/org/traccar/config/Config.java b/src/main/java/org/traccar/config/Config.java index 77184a528..1231918c6 100644 --- a/src/main/java/org/traccar/config/Config.java +++ b/src/main/java/org/traccar/config/Config.java @@ -15,6 +15,8 @@ */ package org.traccar.config; +import com.google.common.annotations.VisibleForTesting; + import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -133,18 +135,14 @@ public class Config { } public double getDouble(ConfigKey key) { - return getDouble(key.getKey(), 0.0); + return getDouble(key, 0.0); } public double getDouble(ConfigKey key, double defaultValue) { - return getDouble(key.getKey(), defaultValue); - } - - @Deprecated - public double getDouble(String key, double defaultValue) { - return hasKey(key) ? Double.parseDouble(getString(key)) : defaultValue; + return hasKey(key.getKey()) ? Double.parseDouble(getString(key.getKey())) : defaultValue; } + @VisibleForTesting public void setString(ConfigKey key, String value) { properties.put(key.getKey(), value); } diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java index 206295499..c8d3f4ccc 100644 --- a/src/main/java/org/traccar/config/Keys.java +++ b/src/main/java/org/traccar/config/Keys.java @@ -69,6 +69,25 @@ public final class Keys { public static final ConfigKey EVENT_IGNORE_DUPLICATE_ALERTS = new ConfigKey( "event.ignoreDuplicateAlerts", Boolean.class); + /** + * If set to true, invalid positions will be considered for motion logic. + */ + public static final ConfigKey EVENT_MOTION_PROCESS_INVALID_POSITIONS = new ConfigKey( + "event.motion.processInvalidPositions", Boolean.class); + + /** + * If the speed is above specified value, the object is considered to be in motion. Default value is 0.01 knots. + */ + public static final ConfigKey EVENT_MOTION_SPEED_THRESHOLD = new ConfigKey( + "event.motion.speedThreshold", Double.class); + + /** + * Global polyline geofence distance. Within that distance from the polyline, point is considered within the + * geofence. Each individual geofence can also has 'polylineDistance' attribute which will take precedence. + */ + public static final ConfigKey GEOFENCE_POLYLINE_DISTANCE = new ConfigKey( + "geofence.polylineDistance", Double.class); + /** * List of external handler classes to use in Netty pipeline. */ -- cgit v1.2.3