aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan-Piet Mens <jpmens@gmail.com>2017-06-14 23:43:01 +0200
committerJan-Piet Mens <jpmens@gmail.com>2017-06-14 23:43:01 +0200
commitd01591f1c0de50b6aa399b0ece00d422897a48e5 (patch)
tree7bf259a4279a346a23456c0956bca0c912981fca /src
parentc432acb0fbc43433c2ada22de50bfdb86c1dcb03 (diff)
downloadtraccar-server-d01591f1c0de50b6aa399b0ece00d422897a48e5.tar.gz
traccar-server-d01591f1c0de50b6aa399b0ece00d422897a48e5.tar.bz2
traccar-server-d01591f1c0de50b6aa399b0ece00d422897a48e5.zip
changes for review
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/OwnTracksProtocolDecoder.java19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/org/traccar/protocol/OwnTracksProtocolDecoder.java b/src/org/traccar/protocol/OwnTracksProtocolDecoder.java
index 4efed2a35..4bff3c7ed 100644
--- a/src/org/traccar/protocol/OwnTracksProtocolDecoder.java
+++ b/src/org/traccar/protocol/OwnTracksProtocolDecoder.java
@@ -63,8 +63,6 @@ public class OwnTracksProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- long timestamp;
- String deviceId = new String();
Position position = new Position();
position.setProtocol(getProtocolName());
position.setValid(true);
@@ -94,27 +92,20 @@ public class OwnTracksProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_BATTERY, root.getInt("batt"));
}
- if (root.containsKey("tst")) {
- timestamp = root.getJsonNumber("tst").longValue();
- if (timestamp < Integer.MAX_VALUE) {
- timestamp *= 1000;
- }
- } else {
- timestamp = new Date().getTime();
- }
- position.setTime(new Date(timestamp));
+ position.setTime(new Date(root.getJsonNumber("tst").longValue() * 1000));
+ String uniqueId = "";
if (root.containsKey("tid")) {
- deviceId = root.getString("tid");
+ uniqueId = root.getString("tid");
}
if (root.containsKey("topic")) {
- deviceId = root.getString("topic");
+ uniqueId = root.getString("topic");
if (root.containsKey("tid")) {
position.set("tid", root.getString("tid"));
}
}
- DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, deviceId);
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, uniqueId);
if (deviceSession == null) {
sendResponse(channel, HttpResponseStatus.BAD_REQUEST);
return null;