aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/events/CommandResultEventHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-18 10:28:51 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-12-18 10:28:51 +1300
commit2f3d3bce533b5fe7f5b4f530fa5360db2ba2262d (patch)
treee7937d70c71cf5c15590575053fdd39ba380249a /src/org/traccar/events/CommandResultEventHandler.java
parent00a6a9ed3718937b2072d5a6301b5c273d21206f (diff)
downloadtrackermap-server-2f3d3bce533b5fe7f5b4f530fa5360db2ba2262d.tar.gz
trackermap-server-2f3d3bce533b5fe7f5b4f530fa5360db2ba2262d.tar.bz2
trackermap-server-2f3d3bce533b5fe7f5b4f530fa5360db2ba2262d.zip
Include data directly into events
Diffstat (limited to 'src/org/traccar/events/CommandResultEventHandler.java')
-rw-r--r--src/org/traccar/events/CommandResultEventHandler.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/events/CommandResultEventHandler.java b/src/org/traccar/events/CommandResultEventHandler.java
index aaa1d23f0..077c389c9 100644
--- a/src/org/traccar/events/CommandResultEventHandler.java
+++ b/src/org/traccar/events/CommandResultEventHandler.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 CommandResultEventHandler extends BaseEventHandler {
protected Collection<Event> analyzePosition(Position position) {
Object commandResult = position.getAttributes().get(Position.KEY_RESULT);
if (commandResult != null) {
- Collection<Event> events = new ArrayList<>();
- events.add(new Event(Event.TYPE_COMMAND_RESULT, position.getDeviceId(), position.getId()));
- return events;
+ Event event = new Event(Event.TYPE_COMMAND_RESULT, position.getDeviceId(), position.getId());
+ event.set(Position.KEY_RESULT, (String) commandResult);
+ return Collections.singleton(event);
}
return null;
}