aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Context.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-08-11 23:37:16 +1200
committerGitHub <noreply@github.com>2017-08-11 23:37:16 +1200
commit30e8409375f9992a5248f7e2597691c0ee08188c (patch)
treeea51b7d111cfae849d23941ad82045139e87520b /src/org/traccar/Context.java
parent3562e0d927d539a1e9730c48ed376ee84ebc2b25 (diff)
parent26db3ccc2ed5d43a0e791a29d5cc4afca192e4b7 (diff)
downloadtrackermap-server-30e8409375f9992a5248f7e2597691c0ee08188c.tar.gz
trackermap-server-30e8409375f9992a5248f7e2597691c0ee08188c.tar.bz2
trackermap-server-30e8409375f9992a5248f7e2597691c0ee08188c.zip
Merge pull request #3431 from Abyss777/delayed_overspeed
Implement delayed overspeed events
Diffstat (limited to 'src/org/traccar/Context.java')
-rw-r--r--src/org/traccar/Context.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index 306a37e83..a69b1786d 100644
--- a/src/org/traccar/Context.java
+++ b/src/org/traccar/Context.java
@@ -41,6 +41,8 @@ import org.traccar.database.GeofenceManager;
import org.traccar.database.GroupsManager;
import org.traccar.database.StatisticsManager;
import org.traccar.database.UsersManager;
+import org.traccar.events.MotionEventHandler;
+import org.traccar.events.OverspeedEventHandler;
import org.traccar.geocoder.BingMapsGeocoder;
import org.traccar.geocoder.FactualGeocoder;
import org.traccar.geocoder.GeocodeFarmGeocoder;
@@ -65,6 +67,7 @@ import org.traccar.geolocation.GeolocationProvider;
import org.traccar.geolocation.MozillaGeolocationProvider;
import org.traccar.geolocation.OpenCellIdGeolocationProvider;
import org.traccar.notification.EventForwarder;
+import org.traccar.reports.model.TripsConfig;
import org.traccar.smpp.SmppClient;
import org.traccar.web.WebServer;
@@ -229,6 +232,33 @@ public final class Context {
return smppClient;
}
+ private static MotionEventHandler motionEventHandler;
+
+ public static MotionEventHandler getMotionEventHandler() {
+ return motionEventHandler;
+ }
+
+ private static OverspeedEventHandler overspeedEventHandler;
+
+ public static OverspeedEventHandler getOverspeedEventHandler() {
+ return overspeedEventHandler;
+ }
+
+ private static TripsConfig tripsConfig;
+
+ public static TripsConfig getTripsConfig() {
+ return tripsConfig;
+ }
+
+ public static TripsConfig initTripsConfig() {
+ return new TripsConfig(
+ config.getLong("report.trip.minimalTripDistance", 500),
+ config.getLong("report.trip.minimalTripDuration", 300) * 1000,
+ config.getLong("report.trip.minimalParkingDuration", 300) * 1000,
+ config.getBoolean("report.trip.greedyParking"),
+ config.getLong("report.trip.minimalNoDataDuration", 3600) * 1000);
+ }
+
public static void init(String[] arguments) throws Exception {
config = new Config();
@@ -327,6 +357,8 @@ public final class Context {
connectionManager = new ConnectionManager();
+ tripsConfig = initTripsConfig();
+
if (config.getBoolean("event.enable")) {
geofenceManager = new GeofenceManager(dataManager);
calendarManager = new CalendarManager(dataManager);
@@ -350,6 +382,11 @@ public final class Context {
velocityEngine = new VelocityEngine();
velocityEngine.init(velocityProperties);
+
+ motionEventHandler = new MotionEventHandler(tripsConfig);
+ overspeedEventHandler = new OverspeedEventHandler(
+ Context.getConfig().getLong("event.overspeed.minimalDuration") * 1000,
+ Context.getConfig().getBoolean("event.overspeed.notRepeat"));
}
serverManager = new ServerManager();