aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/GlobalstarProtocolDecoder.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/protocol/GlobalstarProtocolDecoder.java b/src/main/java/org/traccar/protocol/GlobalstarProtocolDecoder.java
index de23ea170..b742d0cac 100644
--- a/src/main/java/org/traccar/protocol/GlobalstarProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/GlobalstarProtocolDecoder.java
@@ -60,9 +60,9 @@ import java.util.List;
public class GlobalstarProtocolDecoder extends BaseHttpProtocolDecoder {
- private DocumentBuilder documentBuilder;
- private XPath xPath;
- private XPathExpression messageExpression;
+ private final DocumentBuilder documentBuilder;
+ private final XPath xPath;
+ private final XPathExpression messageExpression;
public GlobalstarProtocolDecoder(Protocol protocol) {
super(protocol);
@@ -161,17 +161,20 @@ public class GlobalstarProtocolDecoder extends BaseHttpProtocolDecoder {
position.setLongitude(position.getLongitude() - 360);
}
- position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
+ int speed = buf.readUnsignedByte();
+ position.setSpeed(UnitsConverter.knotsFromKph(speed));
position.set("batteryReplace", BitUtil.check(buf.readUnsignedByte(), 7));
- positions.add(position);
+ if (speed != 0xff) {
+ positions.add(position);
+ }
}
}
sendResponse(channel, document.getFirstChild().getAttributes().getNamedItem("messageID").getNodeValue());
- return positions;
+ return !positions.isEmpty() ? positions : null;
}
}