aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMatjaž Črnko <m.crnko@txt.si>2023-06-21 12:00:52 +0200
committerMatjaž Črnko <m.crnko@txt.si>2023-06-21 12:00:52 +0200
commitb8e9d39d711c0d9f2af26aa90bfb167af364a8d3 (patch)
treea9dce59152193aa95ac5a4146d62cece1c9a79f2 /src/main
parenta3b03c7744a6767cede6725ba7089823e11b983a (diff)
downloadtrackermap-server-b8e9d39d711c0d9f2af26aa90bfb167af364a8d3.tar.gz
trackermap-server-b8e9d39d711c0d9f2af26aa90bfb167af364a8d3.tar.bz2
trackermap-server-b8e9d39d711c0d9f2af26aa90bfb167af364a8d3.zip
Ruptela Decoder use Bitutil for record extension merging
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java8
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)