diff options
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java index 294768860..ecb5c4204 100644 --- a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java @@ -22,6 +22,7 @@ import org.traccar.BaseProtocolDecoder; import org.traccar.session.DeviceSession; import org.traccar.NetworkMessage; import org.traccar.Protocol; +import org.traccar.helper.BitUtil; import org.traccar.helper.DataConverter; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; @@ -236,9 +237,9 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // timestamp extension if (type == MSG_EXTENDED_RECORDS) { - int b = buf.readUnsignedByte(); // record extension - int noRecordsToMerge = (b & 0xf0) >> 4; - int currentRecord = b & 0x0f; + int recordExtension = buf.readUnsignedByte(); // record extension + int noRecordsToMerge = BitUtil.between(recordExtension, 4, 8); + int currentRecord = BitUtil.to(recordExtension, 4); if (currentRecord > 0 && noRecordsToMerge >= currentRecord) { if (!positions.isEmpty() @@ -247,7 +248,6 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { position = positions.remove(positions.size() - 1); } } - } buf.readUnsignedByte(); // priority (reserved) |