aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorStefan Clark <stefanclark@gmail.com>2022-07-23 08:28:00 +0000
committerStefan Clark <stefanclark@gmail.com>2022-07-23 08:28:00 +0000
commit0242c8c9a2983ed2e082bb64d7941b4d345aa734 (patch)
tree432b9ceefb96284645b4f4d73cf09b545e19dd11 /src/main/java
parentc85bcf1966e690d8af56d0eff51dbae5c025340e (diff)
downloadtrackermap-server-0242c8c9a2983ed2e082bb64d7941b4d345aa734.tar.gz
trackermap-server-0242c8c9a2983ed2e082bb64d7941b4d345aa734.tar.bz2
trackermap-server-0242c8c9a2983ed2e082bb64d7941b4d345aa734.zip
Added test csse & updated code for Xexun2ProtocolDecoder
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java
index 3f37d7cac..402095391 100644
--- a/src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java
@@ -178,22 +178,25 @@ public class Xexun2ProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(convertCoordinate(buf.readDouble()));
}
if (BitUtil.check(positionMask, 7)) {
- if (buf.readUnsignedShort() > 0) {
+ int dataLength = buf.readUnsignedShort();
+ if (dataLength > 0) {
if (buf.readByte() != 'G') {
- buf.skipBytes(buf.readUnsignedShort());
+ buf.skipBytes(dataLength - 1);
} else {
int gpsDataLen = buf.readUnsignedShort();
if (gpsDataLen != 27) {
- buf.skipBytes(gpsDataLen);
+ buf.skipBytes(dataLength - 3);
} else {
+ position.setFixTime(position.getDeviceTime());
position.setLongitude(convertCoordinate(buf.readDouble()));
position.setLatitude(convertCoordinate(buf.readDouble()));
position.setValid(buf.readUnsignedByte() > 0);
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
- buf.readUnsignedByte(1); // satellite signal to noise ratio
+ buf.readUnsignedByte(); // satellite signal to noise ratio
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort() * 0.1));
position.setCourse(buf.readUnsignedShort() * 0.1);
position.setAltitude(buf.readFloat());
+ buf.skipBytes(dataLength - 30);
}
}
}