aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-03-11 21:09:09 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-03-11 21:09:09 -0700
commit26cc87fd06b94400ee769e8c2985778b3b6e8ff6 (patch)
tree997f7a5d3301ce6bd2e4b93943fd5adf58341d8e /src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java
parent9caf803986d14661e2e1842b80ee3aa58c8d5c6d (diff)
downloadtrackermap-server-26cc87fd06b94400ee769e8c2985778b3b6e8ff6.tar.gz
trackermap-server-26cc87fd06b94400ee769e8c2985778b3b6e8ff6.tar.bz2
trackermap-server-26cc87fd06b94400ee769e8c2985778b3b6e8ff6.zip
Decode additional attributes
Diffstat (limited to 'src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java b/src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java
index bda0600cc..c2c3d0fc3 100644
--- a/src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java
@@ -101,10 +101,16 @@ public class SigfoxProtocolDecoder extends BaseHttpProtocolDecoder {
if (json.containsKey("time")) {
position.setTime(new Date(getJsonInt(json, "time") * 1000L));
+ } else if (json.containsKey("positionTime")) {
+ position.setTime(new Date(getJsonInt(json, "positionTime") * 1000L));
} else {
position.setTime(new Date());
}
+ if (json.containsKey("lastSeen")) {
+ position.setDeviceTime(new Date(getJsonInt(json, "lastSeen") * 1000L));
+ }
+
if (json.containsKey("location")
|| json.containsKey("lat") && json.containsKey("lng") && !json.containsKey("data")
|| json.containsKey("latitude") && json.containsKey("longitude") && !json.containsKey("data")) {
@@ -120,6 +126,16 @@ public class SigfoxProtocolDecoder extends BaseHttpProtocolDecoder {
position.setLatitude(getJsonDouble(location, location.containsKey("lat") ? "lat" : "latitude"));
position.setLongitude(getJsonDouble(location, location.containsKey("lng") ? "lng" : "longitude"));
+ if (location.containsKey("moving")) {
+ position.set(Position.KEY_MOTION, location.getBoolean("moving"));
+ }
+ if (location.containsKey("magStatus")) {
+ position.set(Position.KEY_BLOCKED, location.getBoolean("magStatus"));
+ }
+ if (location.containsKey("temperature")) {
+ position.set(Position.KEY_DEVICE_TEMP, location.getJsonNumber("temperature").doubleValue());
+ }
+
} else {
String data = json.getString(json.containsKey("data") ? "data" : "payload");