aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/AlertEventHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/events/AlertEventHandler.java')
-rw-r--r--src/org/traccar/events/AlertEventHandler.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/events/AlertEventHandler.java b/src/org/traccar/events/AlertEventHandler.java
index 296fe488c..7d0bd669b 100644
--- a/src/org/traccar/events/AlertEventHandler.java
+++ b/src/org/traccar/events/AlertEventHandler.java
@@ -15,8 +15,8 @@
*/
package org.traccar.events;
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import org.traccar.BaseEventHandler;
import org.traccar.model.Event;
@@ -28,9 +28,9 @@ public class AlertEventHandler extends BaseEventHandler {
protected Collection<Event> analyzePosition(Position position) {
Object alarm = position.getAttributes().get(Position.KEY_ALARM);
if (alarm != null) {
- Collection<Event> events = new ArrayList<>();
- events.add(new Event(Event.TYPE_ALARM, position.getDeviceId(), position.getId()));
- return events;
+ Event event = new Event(Event.TYPE_ALARM, position.getDeviceId(), position.getId());
+ event.set(Position.KEY_ALARM, (String) alarm);
+ return Collections.singleton(event);
}
return null;
}