From 1b8e05ce34ff7c576c29e383601f74cb8c01d728 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Thu, 16 Jun 2016 11:23:41 +0500 Subject: Moved variables from parent to inheritor --- src/org/traccar/events/MotionEventHandler.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/org/traccar/events/MotionEventHandler.java') diff --git a/src/org/traccar/events/MotionEventHandler.java b/src/org/traccar/events/MotionEventHandler.java index c05bd4843..d10513d26 100644 --- a/src/org/traccar/events/MotionEventHandler.java +++ b/src/org/traccar/events/MotionEventHandler.java @@ -37,17 +37,19 @@ public class MotionEventHandler extends BaseEventHandler { @Override protected Collection analyzePosition(Position position) { - Collection result = null; - if (!isLastPosition()) { + + Device device = Context.getDataManager().getDeviceById(position.getDeviceId()); + if (device == null) { + return null; + } + if (position.getId() != device.getPositionId() || !position.getValid()) { return null; } + Collection result = null; double speed = position.getSpeed(); boolean valid = position.getValid(); - if (getDevice() == null) { - return null; - } - String motion = getDevice().getMotion(); + String motion = device.getMotion(); if (motion == null) { motion = Device.STATUS_STOPPED; } -- cgit v1.2.3