diff options
author | Matjaž Črnko <m.crnko@txt.si> | 2023-06-21 12:00:52 +0200 |
---|---|---|
committer | Matjaž Črnko <m.crnko@txt.si> | 2023-06-21 12:00:52 +0200 |
commit | b8e9d39d711c0d9f2af26aa90bfb167af364a8d3 (patch) | |
tree | a9dce59152193aa95ac5a4146d62cece1c9a79f2 /src/main/java/org | |
parent | a3b03c7744a6767cede6725ba7089823e11b983a (diff) | |
download | trackermap-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/java/org')
-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) |