aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/G1rusProtocolDecoder.java8
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;