aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2023-06-21 11:39:17 -0700
committerGitHub <noreply@github.com>2023-06-21 11:39:17 -0700
commit55573d0c27373ca8fd76b46b97cfcf6bc8a87e69 (patch)
tree1f585cdfdd4c2e92732be93e5c7e8604d80bc088
parenta2c35b1c98a56d07924f955bb6d4172f27623816 (diff)
parenteccbcfdd6906979763d0825f2b112a3050343381 (diff)
downloadtrackermap-server-55573d0c27373ca8fd76b46b97cfcf6bc8a87e69.tar.gz
trackermap-server-55573d0c27373ca8fd76b46b97cfcf6bc8a87e69.tar.bz2
trackermap-server-55573d0c27373ca8fd76b46b97cfcf6bc8a87e69.zip
Merge pull request #5124 from jinzo/ruptela-extended-record-merging
Ruptela extended messages merging
-rw-r--r--src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
index 1755ba8a8..2122d5081 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;
@@ -123,7 +124,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_ADC + 2, readValue(buf, length, false));
break;
case 29:
- position.set(Position.KEY_POWER, readValue(buf, length, false));
+ position.set(Position.KEY_POWER, readValue(buf, length, false) * 0.001);
break;
case 30:
position.set(Position.KEY_BATTERY, readValue(buf, length, false) * 0.001);
@@ -236,7 +237,13 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // timestamp extension
if (type == MSG_EXTENDED_RECORDS) {
- buf.readUnsignedByte(); // record extension
+ int recordExtension = buf.readUnsignedByte();
+ int mergeRecordCount = BitUtil.from(recordExtension, 4);
+ int currentRecord = BitUtil.to(recordExtension, 4);
+
+ if (currentRecord > 0 && currentRecord <= mergeRecordCount) {
+ position = positions.remove(positions.size() - 1);
+ }
}
buf.readUnsignedByte(); // priority (reserved)