aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/OverspeedEventHandler.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-06-16 11:23:41 +0500
committerAbyss777 <abyss@fox5.ru>2016-06-16 11:23:41 +0500
commit1b8e05ce34ff7c576c29e383601f74cb8c01d728 (patch)
tree72356a7e9384d46aa2ed31e08765a893abe7c8b8 /src/org/traccar/events/OverspeedEventHandler.java
parent3f0f6c1f6ec4665783ec62a65f8f30a33f1d2152 (diff)
downloadtrackermap-server-1b8e05ce34ff7c576c29e383601f74cb8c01d728.tar.gz
trackermap-server-1b8e05ce34ff7c576c29e383601f74cb8c01d728.tar.bz2
trackermap-server-1b8e05ce34ff7c576c29e383601f74cb8c01d728.zip
Moved variables from parent to inheritor
Diffstat (limited to 'src/org/traccar/events/OverspeedEventHandler.java')
-rw-r--r--src/org/traccar/events/OverspeedEventHandler.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/org/traccar/events/OverspeedEventHandler.java b/src/org/traccar/events/OverspeedEventHandler.java
index f4676b995..e14d4bcea 100644
--- a/src/org/traccar/events/OverspeedEventHandler.java
+++ b/src/org/traccar/events/OverspeedEventHandler.java
@@ -21,6 +21,7 @@ import java.util.Collection;
import org.traccar.BaseEventHandler;
import org.traccar.Context;
+import org.traccar.model.Device;
import org.traccar.model.Event;
import org.traccar.model.Position;
import org.traccar.helper.Log;
@@ -38,10 +39,16 @@ public class OverspeedEventHandler extends BaseEventHandler {
@Override
protected Collection<Event> analyzePosition(Position position) {
- Collection<Event> events = new ArrayList<>();
- if (!isLastPosition()) {
+
+ Device device = Context.getDataManager().getDeviceById(position.getDeviceId());
+ if (device == null) {
+ return null;
+ }
+ if (position.getId() != device.getPositionId() || !position.getValid()) {
return null;
}
+
+ Collection<Event> events = new ArrayList<>();
double speed = position.getSpeed();
boolean valid = position.getValid();