aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-16 12:24:24 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-16 12:24:24 +1300
commit28d60da9a2f80fa8fc3dd28ec5bdd7847a36727c (patch)
tree22ae7f454d71e1e37ce5acdedbd8373b930dbfe7 /src/org/traccar
parentaeaa108befa6b9851db0cb9473a808f6ce9695ae (diff)
downloadtrackermap-server-28d60da9a2f80fa8fc3dd28ec5bdd7847a36727c.tar.gz
trackermap-server-28d60da9a2f80fa8fc3dd28ec5bdd7847a36727c.tar.bz2
trackermap-server-28d60da9a2f80fa8fc3dd28ec5bdd7847a36727c.zip
Extend async request to include devices
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/web/AsyncServlet.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/org/traccar/web/AsyncServlet.java b/src/org/traccar/web/AsyncServlet.java
index 3347f765c..ddcbce2ff 100644
--- a/src/org/traccar/web/AsyncServlet.java
+++ b/src/org/traccar/web/AsyncServlet.java
@@ -158,7 +158,16 @@ public class AsyncServlet extends BaseServlet {
JsonObjectBuilder result = Json.createObjectBuilder();
result.add("success", true);
- result.add("data", JsonConverter.arrayToJson(positions.values()));
+
+ if (Context.getConfig().getBoolean("web.oldAsyncFormat")) {
+ result.add("data", JsonConverter.arrayToJson(positions.values()));
+ } else {
+ JsonObjectBuilder data = Json.createObjectBuilder();
+ data.add("devices", Json.createArrayBuilder().build()); // TODO: send device status
+ data.add("positions", JsonConverter.arrayToJson(positions.values()));
+ result.add("data", data.build());
+ }
+
positions.clear();
try {