diff options
author | Abyss777 <abyss@fox5.ru> | 2016-06-14 18:05:05 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-06-14 18:05:05 +0500 |
commit | b588b3c723cad4629dcecbce8983933f7ff2a255 (patch) | |
tree | ee1ed23c7c02ded8ca92c904e6f4f21aacfda8d8 /src/org/traccar/events/OverspeedEventHandler.java | |
parent | 185c0830e17b6969977026d4be27e34878bb3db9 (diff) | |
download | trackermap-server-b588b3c723cad4629dcecbce8983933f7ff2a255.tar.gz trackermap-server-b588b3c723cad4629dcecbce8983933f7ff2a255.tar.bz2 trackermap-server-b588b3c723cad4629dcecbce8983933f7ff2a255.zip |
- Overlapping geofences
- Simplified user-device link
Diffstat (limited to 'src/org/traccar/events/OverspeedEventHandler.java')
-rw-r--r-- | src/org/traccar/events/OverspeedEventHandler.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/org/traccar/events/OverspeedEventHandler.java b/src/org/traccar/events/OverspeedEventHandler.java index 30410ff32..152fe6f22 100644 --- a/src/org/traccar/events/OverspeedEventHandler.java +++ b/src/org/traccar/events/OverspeedEventHandler.java @@ -1,6 +1,8 @@ package org.traccar.events; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; import org.traccar.BaseEventHandler; import org.traccar.Context; @@ -20,10 +22,10 @@ public class OverspeedEventHandler extends BaseEventHandler { } @Override - protected Event analizePosition(Position position) { - Event event = null; + protected Collection<Event> analizePosition(Position position) { + Collection<Event> events = new ArrayList<>(); if (!isLastPosition()) { - return event; + return null; } double speed = position.getSpeed(); boolean valid = position.getValid(); @@ -32,14 +34,14 @@ public class OverspeedEventHandler extends BaseEventHandler { try { if (Context.getDataManager().getLastEvents( position.getDeviceId(), Event.TYPE_DEVICE_OVERSPEED, suppressRepeated).isEmpty()) { - event = new Event(Event.TYPE_DEVICE_OVERSPEED, position.getDeviceId(), position.getId()); + events.add(new Event(Event.TYPE_DEVICE_OVERSPEED, position.getDeviceId(), position.getId())); } } catch (SQLException error) { Log.warning(error); } } - return event; + return events; } } |