aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/MotionEventHandler.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-08-10 09:03:02 +0500
committerAbyss777 <abyss@fox5.ru>2017-08-10 09:03:02 +0500
commit34faf7e1d024596b388d1dd3a062f19adde0027c (patch)
treed324c1a602a4b8e5034785896076fd73a24811b4 /src/org/traccar/events/MotionEventHandler.java
parent94a922eaf167a73a0188255398fb1c6799767e18 (diff)
downloadtrackermap-server-34faf7e1d024596b388d1dd3a062f19adde0027c.tar.gz
trackermap-server-34faf7e1d024596b388d1dd3a062f19adde0027c.tar.bz2
trackermap-server-34faf7e1d024596b388d1dd3a062f19adde0027c.zip
Rename variables
Diffstat (limited to 'src/org/traccar/events/MotionEventHandler.java')
-rw-r--r--src/org/traccar/events/MotionEventHandler.java27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/org/traccar/events/MotionEventHandler.java b/src/org/traccar/events/MotionEventHandler.java
index 9168d0fd8..228b43c0f 100644
--- a/src/org/traccar/events/MotionEventHandler.java
+++ b/src/org/traccar/events/MotionEventHandler.java
@@ -1,5 +1,6 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,9 +33,7 @@ public class MotionEventHandler extends BaseEventHandler {
private TripsConfig tripsConfig;
public MotionEventHandler() {
- if (Context.getConfig() != null) {
- tripsConfig = ReportUtils.initTripsConfig();
- }
+ tripsConfig = ReportUtils.initTripsConfig();
}
public static Event updateMotionState(DeviceState deviceState, Position position, TripsConfig tripsConfig) {
@@ -51,22 +50,22 @@ public class MotionEventHandler extends BaseEventHandler {
deviceState.setMotionPosition(null);
}
- Position potentialPosition = deviceState.getMotionPosition();
- if (potentialPosition != null) {
- long potentialTime = potentialPosition.getFixTime().getTime();
- double distance = ReportUtils.calculateDistance(potentialPosition, position, false);
+ Position motionPosition = deviceState.getMotionPosition();
+ if (motionPosition != null) {
+ long motionTime = motionPosition.getFixTime().getTime();
+ double distance = ReportUtils.calculateDistance(motionPosition, position, false);
if (newMotion) {
- if (potentialTime + tripsConfig.getMinimalTripDuration() <= currentTime
+ if (motionTime + tripsConfig.getMinimalTripDuration() <= currentTime
|| distance >= tripsConfig.getMinimalTripDistance()) {
- result = new Event(Event.TYPE_DEVICE_MOVING, potentialPosition.getDeviceId(),
- potentialPosition.getId());
+ result = new Event(Event.TYPE_DEVICE_MOVING, motionPosition.getDeviceId(),
+ motionPosition.getId());
deviceState.setMotionState(true);
deviceState.setMotionPosition(null);
}
} else {
- if (potentialTime + tripsConfig.getMinimalParkingDuration() <= currentTime) {
- result = new Event(Event.TYPE_DEVICE_STOPPED, potentialPosition.getDeviceId(),
- potentialPosition.getId());
+ if (motionTime + tripsConfig.getMinimalParkingDuration() <= currentTime) {
+ result = new Event(Event.TYPE_DEVICE_STOPPED, motionPosition.getDeviceId(),
+ motionPosition.getId());
deviceState.setMotionState(false);
deviceState.setMotionPosition(null);
}