aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/MotionEventHandler.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-08-10 13:31:18 +0500
committerAbyss777 <abyss@fox5.ru>2017-08-10 13:31:18 +0500
commit532e0a98d469573a575dc595554792cbbd4cd953 (patch)
treef05220655a2df11cbdbe57f8da7e1d86ef27f491 /src/org/traccar/events/MotionEventHandler.java
parentb82be4f9f3b4d1d6c345bc41d5c26aca03e369cb (diff)
downloadtrackermap-server-532e0a98d469573a575dc595554792cbbd4cd953.tar.gz
trackermap-server-532e0a98d469573a575dc595554792cbbd4cd953.tar.bz2
trackermap-server-532e0a98d469573a575dc595554792cbbd4cd953.zip
Implement delayed overspeed events
Diffstat (limited to 'src/org/traccar/events/MotionEventHandler.java')
-rw-r--r--src/org/traccar/events/MotionEventHandler.java10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/org/traccar/events/MotionEventHandler.java b/src/org/traccar/events/MotionEventHandler.java
index 228b43c0f..ed21d7b83 100644
--- a/src/org/traccar/events/MotionEventHandler.java
+++ b/src/org/traccar/events/MotionEventHandler.java
@@ -77,7 +77,8 @@ public class MotionEventHandler extends BaseEventHandler {
@Override
protected Collection<Event> analyzePosition(Position position) {
- Device device = Context.getIdentityManager().getById(position.getDeviceId());
+ long deviceId = position.getDeviceId();
+ Device device = Context.getIdentityManager().getById(deviceId);
if (device == null) {
return null;
}
@@ -86,14 +87,9 @@ public class MotionEventHandler extends BaseEventHandler {
}
Event result = null;
-
- long deviceId = position.getDeviceId();
DeviceState deviceState = Context.getDeviceManager().getDeviceState(deviceId);
- if (deviceState == null) {
- deviceState = new DeviceState();
- deviceState.setMotionState(position.getBoolean(Position.KEY_MOTION));
- } else if (deviceState.getMotionState() == null) {
+ if (deviceState.getMotionState() == null) {
deviceState.setMotionState(position.getBoolean(Position.KEY_MOTION));
} else {
result = updateMotionState(deviceState, position, tripsConfig);