From e43d353b7cc0f2bf34a77d58529c1360683d81c1 Mon Sep 17 00:00:00 2001 From: Matjaž Črnko Date: Wed, 21 Jun 2023 19:15:44 +0200 Subject: Ruptela Decoder - extended records merging, remove redudant checks and better variable naming --- src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java index a8296771a..d067d2ddc 100644 --- a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java @@ -238,15 +238,11 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { if (type == MSG_EXTENDED_RECORDS) { int recordExtension = buf.readUnsignedByte(); - int noRecordsToMerge = BitUtil.between(recordExtension, 4, 8); + int mergeRecordCount = BitUtil.between(recordExtension, 4, 8); int currentRecord = BitUtil.to(recordExtension, 4); - if (currentRecord > 0 && currentRecord <= noRecordsToMerge) { - if (!positions.isEmpty() - && positions.get(positions.size() - 1).getDeviceTime() - .compareTo(position.getDeviceTime()) == 0) { - position = positions.remove(positions.size() - 1); - } + if (currentRecord > 0 && currentRecord <= mergeRecordCount) { + position = positions.remove(positions.size() - 1); } } -- cgit v1.2.3