diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/protocol/SigfoxProtocolDecoder.java | 16 |
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"); |