diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2022-02-06 16:32:35 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2022-02-06 16:32:35 -0800 |
commit | f258382b1203fa31d150e0b090fe5afdb01ede6b (patch) | |
tree | 9932cd5b68efcb856d9605b92d26eb9ba4667953 /src/main/java/org | |
parent | 9de6ffeb75a15422e48ad7d9995b6670b336b3ff (diff) | |
download | trackermap-server-f258382b1203fa31d150e0b090fe5afdb01ede6b.tar.gz trackermap-server-f258382b1203fa31d150e0b090fe5afdb01ede6b.tar.bz2 trackermap-server-f258382b1203fa31d150e0b090fe5afdb01ede6b.zip |
Decode S168 status info
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; + } } } |