diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-06 23:33:12 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-06 23:33:12 +1200 |
commit | f119326f307635dddc6306d4f5a4e349e808b48a (patch) | |
tree | 3c04943e57947b10ac08e4772ac17e38b66611f0 /src | |
parent | 80e166430b79df771abc73e55892dc9f5fd0b2f1 (diff) | |
download | traccar-server-f119326f307635dddc6306d4f5a4e349e808b48a.tar.gz traccar-server-f119326f307635dddc6306d4f5a4e349e808b48a.tar.bz2 traccar-server-f119326f307635dddc6306d4f5a4e349e808b48a.zip |
Display markers on the map
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/database/DataManager.java | 12 | ||||
-rw-r--r-- | src/org/traccar/http/AsyncServlet.java | 3 | ||||
-rw-r--r-- | src/org/traccar/http/JsonConverter.java | 10 |
3 files changed, 18 insertions, 7 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 2aca1ff87..3a34be2d7 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -187,8 +187,9 @@ public class DataManager { private NamedParameterStatement.Params assignVariables(NamedParameterStatement.Params params, Position position) throws SQLException { params.setString("protocol", position.getProtocol()); - params.setLong("device_id", position.getDeviceId()); - params.setTimestamp("time", position.getFixTime()); + params.setLong("deviceId", position.getDeviceId()); + params.setTimestamp("deviceTime", position.getDeviceTime()); + params.setTimestamp("fixTime", position.getFixTime()); params.setBoolean("valid", position.getValid()); params.setDouble("altitude", position.getAltitude()); params.setDouble("latitude", position.getLatitude()); @@ -196,8 +197,13 @@ public class DataManager { params.setDouble("speed", position.getSpeed()); params.setDouble("course", position.getCourse()); params.setString("address", position.getAddress()); + params.setString("other", position.getOther()); + + // temporary + params.setTimestamp("time", position.getFixTime()); + params.setLong("device_id", position.getDeviceId()); + params.setLong("power", null); params.setString("extended_info", position.getOther()); - params.setLong("power", null); // temporary return params; } diff --git a/src/org/traccar/http/AsyncServlet.java b/src/org/traccar/http/AsyncServlet.java index aeab5855b..f00257f80 100644 --- a/src/org/traccar/http/AsyncServlet.java +++ b/src/org/traccar/http/AsyncServlet.java @@ -34,7 +34,6 @@ import org.traccar.Context; import org.traccar.GlobalTimer; import org.traccar.database.DataCache; import org.traccar.helper.Log; -import org.traccar.model.Event; import org.traccar.model.Position; public class AsyncServlet extends HttpServlet { @@ -51,7 +50,7 @@ public class AsyncServlet extends HttpServlet { private static final boolean DEBUG_ASYNC = true; private static final long SESSION_TIMEOUT = 30; - private static final long REQUEST_TIMEOUT = 30; + private static final long REQUEST_TIMEOUT = 10; private boolean destroyed; private final long userId; diff --git a/src/org/traccar/http/JsonConverter.java b/src/org/traccar/http/JsonConverter.java index 48fd934b7..0802fb9ea 100644 --- a/src/org/traccar/http/JsonConverter.java +++ b/src/org/traccar/http/JsonConverter.java @@ -93,9 +93,15 @@ public class JsonConverter { } else if (method.getReturnType().equals(double.class)) { json.add(name, (Double) method.invoke(object)); } else if (method.getReturnType().equals(String.class)) { - json.add(name, (String) method.invoke(object)); + String value = (String) method.invoke(object); + if (value != null) { + json.add(name, value); + } } else if (method.getReturnType().equals(Date.class)) { - json.add(name, dateFormat.format((Date) method.invoke(object))); + Date value = (Date) method.invoke(object); + if (value != null) { + json.add(name, dateFormat.format(value)); + } } } catch (IllegalAccessException error) { } catch (InvocationTargetException error) { |