Skip to content

Commit

Permalink
Mapped the gpsStatus to a validity state
Browse files Browse the repository at this point in the history
  • Loading branch information
Maarten Meersseman committed Jul 18, 2018
1 parent ed8a095 commit 586eff6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/org/traccar/protocol/TeltonikaProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
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;
Expand Down Expand Up @@ -126,7 +127,10 @@ private void decodeOtherParameter(Position position, int id, ByteBuf buf, int le
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);
Expand Down

0 comments on commit 586eff6

Please sign in to comment.