From 586eff69dde0111c6acd47ea5ecff0beac1d626c Mon Sep 17 00:00:00 2001 From: Maarten Meersseman Date: Wed, 18 Jul 2018 11:56:15 +0200 Subject: Mapped the gpsStatus to a validity state --- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 5b5097b8f..3892b107b 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -36,6 +36,7 @@ import java.util.LinkedList; import java.util.List; public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { + private static final long GPS_STATUS_WORKING_WITH_GPS_FIX = 3; private boolean connectionless; private boolean extended; @@ -126,7 +127,10 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, readValue(buf, length, false) * 0.001); break; case 69: - position.set("gpsStatus", readValue(buf, length, false)); + final long gpsStatus = readValue(buf, length, false); + position.set("gpsStatus", gpsStatus); + final boolean validGpsStatus = GPS_STATUS_WORKING_WITH_GPS_FIX == gpsStatus; + position.setValid(position.getValid() && validGpsStatus); break; case 72: position.set(Position.PREFIX_TEMP + 1, readValue(buf, length, true) * 0.1); -- cgit v1.2.3