aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/MotionEventHandler.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-07-28 11:42:10 +0500
committerAbyss777 <abyss@fox5.ru>2016-07-28 11:42:10 +0500
commitf7e82c4d9a66b8ab1ba90d4cae690f9c798d03a7 (patch)
treed7629335bf8cc14ca4531f198713b4c69b53e6a7 /src/org/traccar/events/MotionEventHandler.java
parentb00b35b33095110cef46c8a255686cad87ac7150 (diff)
downloadtrackermap-server-f7e82c4d9a66b8ab1ba90d4cae690f9c798d03a7.tar.gz
trackermap-server-f7e82c4d9a66b8ab1ba90d4cae690f9c798d03a7.tar.bz2
trackermap-server-f7e82c4d9a66b8ab1ba90d4cae690f9c798d03a7.zip
Removed suppressing repeated events during analyzing.
Diffstat (limited to 'src/org/traccar/events/MotionEventHandler.java')
-rw-r--r--src/org/traccar/events/MotionEventHandler.java32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/org/traccar/events/MotionEventHandler.java b/src/org/traccar/events/MotionEventHandler.java
index 4b652a727..ddb99185f 100644
--- a/src/org/traccar/events/MotionEventHandler.java
+++ b/src/org/traccar/events/MotionEventHandler.java
@@ -15,13 +15,11 @@
*/
package org.traccar.events;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import org.traccar.BaseEventHandler;
import org.traccar.Context;
-import org.traccar.helper.Log;
import org.traccar.model.Device;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -29,11 +27,6 @@ import org.traccar.model.Position;
public class MotionEventHandler extends BaseEventHandler {
private static final double SPEED_THRESHOLD = 0.01;
- private int suppressRepeated;
-
- public MotionEventHandler() {
- suppressRepeated = Context.getConfig().getInteger("event.suppressRepeated", 60);
- }
@Override
protected Collection<Event> analyzePosition(Position position) {
@@ -53,25 +46,12 @@ public class MotionEventHandler extends BaseEventHandler {
if (lastPosition != null) {
oldSpeed = lastPosition.getSpeed();
}
- try {
- if (speed > SPEED_THRESHOLD && oldSpeed <= SPEED_THRESHOLD) {
- result = new ArrayList<>();
- result.add(new Event(Event.TYPE_DEVICE_MOVING, position.getDeviceId(), position.getId()));
- } else if (speed <= SPEED_THRESHOLD && oldSpeed > SPEED_THRESHOLD) {
- result = new ArrayList<>();
- result.add(new Event(Event.TYPE_DEVICE_STOPPED, position.getDeviceId(), position.getId()));
- }
-
- if (result != null && !result.isEmpty()) {
- for (Event event : result) {
- if (!Context.getDataManager().getLastEvents(position.getDeviceId(),
- event.getType(), suppressRepeated).isEmpty()) {
- event = null;
- }
- }
- }
- } catch (SQLException error) {
- Log.warning(error);
+ if (speed > SPEED_THRESHOLD && oldSpeed <= SPEED_THRESHOLD) {
+ result = new ArrayList<>();
+ result.add(new Event(Event.TYPE_DEVICE_MOVING, position.getDeviceId(), position.getId()));
+ } else if (speed <= SPEED_THRESHOLD && oldSpeed > SPEED_THRESHOLD) {
+ result = new ArrayList<>();
+ result.add(new Event(Event.TYPE_DEVICE_STOPPED, position.getDeviceId(), position.getId()));
}
return result;
}