aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java b/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
index 34125bffa..aded35823 100644
--- a/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
@@ -102,7 +102,6 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
}
position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
- position.setValid(true);
dateBuilder = new DateBuilder(new Date());
} else if (position != null) {
switch (key) {
@@ -122,9 +121,11 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
Integer.parseInt(value.substring(6)) * 10);
break;
case 0xA:
+ position.setValid(true);
position.setLatitude(Double.parseDouble(value));
break;
case 0xB:
+ position.setValid(true);
position.setLongitude(Double.parseDouble(value));
break;
case 0xC:
@@ -177,6 +178,9 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
}
if (position != null) {
+ if (!position.getValid()) {
+ getLastLocation(position, null);
+ }
position.setTime(dateBuilder.getDate());
positions.add(position);
}