Skip to content

Commit

Permalink
Merge pull request traccar#3974 from TheITCloud/gpsStatus
Browse files Browse the repository at this point in the history
Added gps status
  • Loading branch information
tananaev authored Jul 20, 2018
2 parents 4c3f628 + d1dfd6a commit bb56fa4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/org/traccar/protocol/TeltonikaProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ private void decodeOtherParameter(Position position, int id, ByteBuf buf, int le
case 67:
position.set(Position.KEY_BATTERY, readValue(buf, length, false) * 0.001);
break;
case 69:
final long gpsStatus = readValue(buf, length, false);
position.set("gpsStatus", gpsStatus);
position.setValid(gpsStatus == 3);
break;
case 72:
position.set(Position.PREFIX_TEMP + 1, readValue(buf, length, true) * 0.1);
break;
Expand Down Expand Up @@ -301,9 +306,7 @@ private void decodeLocation(Position position, ByteBuf buf, int codec) {
}

if (BitUtil.check(locationMask, 4)) {
int satellites = buf.readUnsignedByte();
position.set(Position.KEY_SATELLITES, satellites);
position.setValid(satellites >= 3);
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
}

if (BitUtil.check(locationMask, 5)) {
Expand Down Expand Up @@ -423,6 +426,7 @@ private List<Position> parseData(
Position position = new Position(getProtocolName());

position.setDeviceId(deviceSession.getDeviceId());
position.setValid(true);

if (codec == CODEC_12) {
decodeSerial(position, buf);
Expand Down

0 comments on commit bb56fa4

Please sign in to comment.