diff options
author | Abyss777 <abyss@fox5.ru> | 2016-05-27 17:14:47 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-05-27 17:14:47 +0500 |
commit | 6e00239038002aa383cce39be7f53b85f3d03a94 (patch) | |
tree | 6b32aab5891ba74b2fba550b29601a6d5c373273 /src/org/traccar/BaseEventHandler.java | |
parent | c6cc8a87eb593dbf765814d1aaa09d5d231fa7fe (diff) | |
download | trackermap-server-6e00239038002aa383cce39be7f53b85f3d03a94.tar.gz trackermap-server-6e00239038002aa383cce39be7f53b85f3d03a94.tar.bz2 trackermap-server-6e00239038002aa383cce39be7f53b85f3d03a94.zip |
- Synchronization device cache on updateLatestPosition and updateDeviceStatus
- Better latest position identification in BaseEventHandler
Diffstat (limited to 'src/org/traccar/BaseEventHandler.java')
-rw-r--r-- | src/org/traccar/BaseEventHandler.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/org/traccar/BaseEventHandler.java b/src/org/traccar/BaseEventHandler.java index 3c2016af0..fde57748c 100644 --- a/src/org/traccar/BaseEventHandler.java +++ b/src/org/traccar/BaseEventHandler.java @@ -1,5 +1,6 @@ package org.traccar; +import org.traccar.model.Device; import org.traccar.model.Event; import org.traccar.model.Position; @@ -14,9 +15,12 @@ public abstract class BaseEventHandler extends BaseDataHandler { @Override protected Position handlePosition(Position position) { - Position lastPosition = Context.getConnectionManager().getLastPosition(position.getDeviceId()); - if (lastPosition == null || position.getFixTime().compareTo(lastPosition.getFixTime()) >= 0) { - isLastPosition = true; + Device device = Context.getDataManager().getDeviceById(position.getDeviceId()); + if (device != null) { + long lastPositionId = device.getPositionId(); + if (position.getId() == lastPositionId) { + isLastPosition = true; + } } Event event = analizePosition(position); |