aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-02-15 10:22:17 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-02-15 10:22:17 -0800
commit4a05b4c4810c430a286f43c2739d04004f90e053 (patch)
tree406b9037aa086a8029fbf078644d4258490c70fc /src
parent89ef9d436cb1ba56ea1f9b63e20afdc665186f9b (diff)
downloadtrackermap-server-4a05b4c4810c430a286f43c2739d04004f90e053.tar.gz
trackermap-server-4a05b4c4810c430a286f43c2739d04004f90e053.tar.bz2
trackermap-server-4a05b4c4810c430a286f43c2739d04004f90e053.zip
Use last known location
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java6
-rw-r--r--src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java3
2 files changed, 8 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);
}
diff --git a/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
index 566d66fd7..decd7fd38 100644
--- a/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
@@ -34,6 +34,9 @@ public class FreematicsProtocolDecoderTest extends ProtocolTest {
verifyPositions(decoder, text(
"1#0=68338,10D=79,30=1010,105=199,10C=4375,104=56,111=62,20=0;-1;95,10=6454200,A=-32.727482,B=150.150301,C=159,D=0,F=5,24=1250*7A"));
+ verifyAttributes(decoder, text(
+ "M0ZR4X0#0:566624,24:1246,20:0;0;0*D"));
+
verifyNull(decoder, text(
"M0ZR4X0#DF=4208,SSI=-71,EV=1,TS=20866,ID=M0ZR4X0*9E"));