From ed8a0952ab8ee3bd23ea9ca616252984e9fe4c70 Mon Sep 17 00:00:00 2001 From: Maarten Meersseman Date: Tue, 17 Jul 2018 13:09:22 +0200 Subject: Added gps status https://github.com/traccar/traccar/issues/3973 --- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 5e9b6640e..5b5097b8f 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -125,6 +125,9 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { case 67: position.set(Position.KEY_BATTERY, readValue(buf, length, false) * 0.001); break; + case 69: + position.set("gpsStatus", readValue(buf, length, false)); + break; case 72: position.set(Position.PREFIX_TEMP + 1, readValue(buf, length, true) * 0.1); break; -- cgit v1.2.3 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(-) (limited to 'src') 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 From 1a87b6958947484d0ab8b5acecf5ff7c3c491fd1 Mon Sep 17 00:00:00 2001 From: Maarten Meersseman Date: Thu, 19 Jul 2018 17:34:28 +0200 Subject: Mapped the gpsStatus to a validity state, no longer considering satellites for validity --- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 3892b107b..5f0380fcd 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -36,7 +36,6 @@ 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; @@ -129,8 +128,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { case 69: 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); + position.setValid(gpsStatus == 3); break; case 72: position.set(Position.PREFIX_TEMP + 1, readValue(buf, length, true) * 0.1); @@ -308,9 +306,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(locationMask, 4)) { - int satellites = buf.readUnsignedByte(); - position.set(Position.KEY_SATELLITES, satellites); - position.setValid(satellites >= 3); + position.set(Position.KEY_SATELLITES, (int) buf.readUnsignedByte()); } if (BitUtil.check(locationMask, 5)) { @@ -430,6 +426,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); + position.setValid(true); if (codec == CODEC_12) { decodeSerial(position, buf); -- cgit v1.2.3 From d1dfd6a9fb16e1682777ca361d91c1669489ca59 Mon Sep 17 00:00:00 2001 From: Maarten Meersseman Date: Fri, 20 Jul 2018 09:35:40 +0200 Subject: removed conversion --- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 5f0380fcd..19f4bd67b 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -306,7 +306,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(locationMask, 4)) { - position.set(Position.KEY_SATELLITES, (int) buf.readUnsignedByte()); + position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); } if (BitUtil.check(locationMask, 5)) { -- cgit v1.2.3