diff options
-rw-r--r-- | src/org/traccar/events/MaintenanceEventHandler.java | 4 | ||||
-rw-r--r-- | src/org/traccar/events/OverspeedEventHandler.java | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/org/traccar/events/MaintenanceEventHandler.java b/src/org/traccar/events/MaintenanceEventHandler.java index 4d0d93080..86836f6af 100644 --- a/src/org/traccar/events/MaintenanceEventHandler.java +++ b/src/org/traccar/events/MaintenanceEventHandler.java @@ -58,7 +58,9 @@ public class MaintenanceEventHandler extends BaseEventHandler { newTotalDistance -= maintenanceStart; if ((long) (oldTotalDistance / maintenanceInterval) < (long) (newTotalDistance / maintenanceInterval)) { - return Collections.singleton(new Event(Event.TYPE_MAINTENANCE, position.getDeviceId(), position.getId())); + Event event = new Event(Event.TYPE_MAINTENANCE, position.getDeviceId(), position.getId()); + event.set(Position.KEY_TOTAL_DISTANCE, newTotalDistance); + return Collections.singleton(event); } return null; diff --git a/src/org/traccar/events/OverspeedEventHandler.java b/src/org/traccar/events/OverspeedEventHandler.java index 67aa0e758..00c3845d2 100644 --- a/src/org/traccar/events/OverspeedEventHandler.java +++ b/src/org/traccar/events/OverspeedEventHandler.java @@ -59,8 +59,10 @@ public class OverspeedEventHandler extends BaseEventHandler { } } if (speed > speedLimit && oldSpeed <= speedLimit) { - return Collections.singleton( - new Event(Event.TYPE_DEVICE_OVERSPEED, position.getDeviceId(), position.getId())); + Event event = new Event(Event.TYPE_DEVICE_OVERSPEED, position.getDeviceId(), position.getId()); + event.set("speed", speed); + event.set(ATTRIBUTE_SPEED_LIMIT, speedLimit); + return Collections.singleton(event); } return null; } |