aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMatjaž Črnko <m.crnko@txt.si>2023-06-21 00:18:46 +0200
committerMatjaž Črnko <m.crnko@txt.si>2023-06-21 00:18:46 +0200
commita3b03c7744a6767cede6725ba7089823e11b983a (patch)
treedfd6958e19cc1369896be6000228cc4e3e32e698 /src/main
parentba8191373d55d6115427ef7187b8f2d0650a5ec5 (diff)
downloadtrackermap-server-a3b03c7744a6767cede6725ba7089823e11b983a.tar.gz
trackermap-server-a3b03c7744a6767cede6725ba7089823e11b983a.tar.bz2
trackermap-server-a3b03c7744a6767cede6725ba7089823e11b983a.zip
Ruptela Decoder - implement Extended protocol extended messages merging
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
index 1755ba8a8..294768860 100644
--- a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
@@ -236,7 +236,18 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // timestamp extension
if (type == MSG_EXTENDED_RECORDS) {
- buf.readUnsignedByte(); // record extension
+ int b = buf.readUnsignedByte(); // record extension
+ int noRecordsToMerge = (b & 0xf0) >> 4;
+ int currentRecord = b & 0x0f;
+
+ if (currentRecord > 0 && noRecordsToMerge >= currentRecord) {
+ if (!positions.isEmpty()
+ && positions.get(positions.size() - 1).getDeviceTime()
+ .compareTo(position.getDeviceTime()) == 0) {
+ position = positions.remove(positions.size() - 1);
+ }
+ }
+
}
buf.readUnsignedByte(); // priority (reserved)