diff options
author | Anton Tananaev <anton@traccar.org> | 2022-10-12 17:47:35 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-10-12 17:47:35 -0700 |
commit | c801d33f44ae346d01e19e47a3b97c8405f4d5b4 (patch) | |
tree | e5e5855d64f8a5de23c0823ca0a2e341dd1a2175 /src/main | |
parent | dfaef4eca85a065e35c360fd6f712b2ad62f2e7a (diff) | |
download | trackermap-server-c801d33f44ae346d01e19e47a3b97c8405f4d5b4.tar.gz trackermap-server-c801d33f44ae346d01e19e47a3b97c8405f4d5b4.tar.bz2 trackermap-server-c801d33f44ae346d01e19e47a3b97c8405f4d5b4.zip |
Fix G1RUS decoding
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/protocol/G1rusProtocolDecoder.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/G1rusProtocolDecoder.java b/src/main/java/org/traccar/protocol/G1rusProtocolDecoder.java index e974e446d..17cfbc1eb 100644 --- a/src/main/java/org/traccar/protocol/G1rusProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/G1rusProtocolDecoder.java @@ -124,8 +124,12 @@ public class G1rusProtocolDecoder extends BaseProtocolDecoder { ByteBuf buf = (ByteBuf) msg; + buf.readUnsignedByte(); // header + buf.readUnsignedByte(); // version + int type = buf.readUnsignedByte(); String imei = String.valueOf(buf.readLong()); + buf.readerIndex(buf.readerIndex() - 1); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei); if (deviceSession == null) { return null; @@ -144,14 +148,14 @@ public class G1rusProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.to(subtype, 6) == MSG_REGULAR) { positions.add(decodeRegular(deviceSession, buf, subtype)); } else { - buf.skipBytes(length); + buf.skipBytes(length - 1); } } return positions.isEmpty() ? null : positions; } - buf.skipBytes(2); + buf.readUnsignedShort(); // checksum buf.readUnsignedByte(); // tail return null; |