From f258382b1203fa31d150e0b090fe5afdb01ede6b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 6 Feb 2022 16:32:35 -0800 Subject: Decode S168 status info --- src/main/java/org/traccar/protocol/S168ProtocolDecoder.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/main') 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; + } } } -- cgit v1.2.3