diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2022-07-23 07:11:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-23 07:11:49 -0700 |
commit | e3006068282d1290110df5861e45bc262bfea358 (patch) | |
tree | e45823c4e1d4616f9eb6d5b890bbd978434d55e0 /src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java | |
parent | 4a10f75f016af996bd15e90101f0d20e4d61e083 (diff) | |
parent | 0242c8c9a2983ed2e082bb64d7941b4d345aa734 (diff) | |
download | trackermap-server-e3006068282d1290110df5861e45bc262bfea358.tar.gz trackermap-server-e3006068282d1290110df5861e45bc262bfea358.tar.bz2 trackermap-server-e3006068282d1290110df5861e45bc262bfea358.zip |
Merge pull request #4910 from stefanclark/protocol-xexun2-update
Update Xexun2ProtocolDecoder.java
Diffstat (limited to 'src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java index a572f8622..402095391 100644 --- a/src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Xexun2ProtocolDecoder.java @@ -176,7 +176,30 @@ public class Xexun2ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); position.setLongitude(convertCoordinate(buf.readDouble())); position.setLatitude(convertCoordinate(buf.readDouble())); - + } + if (BitUtil.check(positionMask, 7)) { + int dataLength = buf.readUnsignedShort(); + if (dataLength > 0) { + if (buf.readByte() != 'G') { + buf.skipBytes(dataLength - 1); + } else { + int gpsDataLen = buf.readUnsignedShort(); + if (gpsDataLen != 27) { + 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(); // 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); + } + } + } } } if (BitUtil.check(mask, 3)) { |