diff options
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/S168ProtocolDecoder.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/S168ProtocolDecoder.java b/src/main/java/org/traccar/protocol/S168ProtocolDecoder.java index 921141698..6d565517b 100644 --- a/src/main/java/org/traccar/protocol/S168ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/S168ProtocolDecoder.java @@ -95,6 +95,10 @@ public class S168ProtocolDecoder extends BaseProtocolDecoder { values[index++].replace('-', ':'), Integer.parseInt(values[index++]))); } break; + case "STATUS": + position.set(Position.KEY_BATTERY_LEVEL, Integer.parseInt(values[index++])); + position.set(Position.KEY_RSSI, Integer.parseInt(values[index++])); + break; default: break; } @@ -103,8 +107,15 @@ public class S168ProtocolDecoder extends BaseProtocolDecoder { if (network.getCellTowers() != null || network.getWifiAccessPoints() != null) { position.setNetwork(network); } + if (!position.getAttributes().containsKey(Position.KEY_SATELLITES)) { + getLastLocation(position, null); + } - return position.getAttributes().containsKey(Position.KEY_SATELLITES) ? position : null; + if (position.getNetwork() != null || !position.getAttributes().isEmpty()) { + return position; + } else { + return null; + } } } |