aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java b/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java
index 25a8f7090..167896386 100644
--- a/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FlexApiProtocolDecoder.java
@@ -55,9 +55,17 @@ public class FlexApiProtocolDecoder extends BaseProtocolDecoder {
if (topic.contains("gnss")) {
position.setValid(true);
- position.setTime(new Date(payload.getInt("time") * 1000L));
- position.setLatitude(payload.getJsonNumber("lat").doubleValue());
- position.setLongitude(payload.getJsonNumber("log").doubleValue());
+
+ if (payload.containsKey("time")) {
+ position.setTime(new Date(payload.getInt("time") * 1000L));
+ position.setLatitude(payload.getJsonNumber("lat").doubleValue());
+ position.setLongitude(payload.getJsonNumber("log").doubleValue());
+ } else {
+ position.setTime(new Date(payload.getInt("gnss.ts") * 1000L));
+ position.setLatitude(payload.getJsonNumber("gnss.latitude").doubleValue());
+ position.setLongitude(payload.getJsonNumber("gnss.longitude").doubleValue());
+ }
+
position.setAltitude(payload.getJsonNumber("gnss.altitude").doubleValue());
position.setSpeed(payload.getJsonNumber("gnss.speed").doubleValue());
position.setCourse(payload.getJsonNumber("gnss.heading").doubleValue());
@@ -81,6 +89,10 @@ public class FlexApiProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_VIN, payload.getString("obd.vin"));
}
+ } else if (topic.contains("cellular1")) {
+
+ getLastLocation(position, new Date(payload.getInt("modem1.ts") * 1000L));
+
} else {
return null;