diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2023-10-04 16:44:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-04 16:44:18 -0500 |
commit | b569b3467d214d1cab8f38dfdf43679e5fd8c592 (patch) | |
tree | 149ca9a67d46aeac6ac21fa2c7ecc4e84f94a946 /src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java | |
parent | 6c78fc675501ab348f877e423b984d1a2a132ef1 (diff) | |
parent | 0867ac8efb8c4b033a9d22ce311ffcf301971b24 (diff) | |
download | trackermap-server-b569b3467d214d1cab8f38dfdf43679e5fd8c592.tar.gz trackermap-server-b569b3467d214d1cab8f38dfdf43679e5fd8c592.tar.bz2 trackermap-server-b569b3467d214d1cab8f38dfdf43679e5fd8c592.zip |
Merge pull request #5190 from jinzo/ruptela-improvements
Extended records spanning multiple messages fix
Diffstat (limited to 'src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java index 649de7c5c..d4f9808ae 100644 --- a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java @@ -51,6 +51,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_SMS_VIA_GPRS = 8; public static final int MSG_DTCS = 9; public static final int MSG_IDENTIFICATION = 15; + public static final int MSG_HEARTBEAT = 16; public static final int MSG_SET_IO = 17; public static final int MSG_FILES = 37; public static final int MSG_EXTENDED_RECORDS = 68; @@ -242,7 +243,11 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { int currentRecord = BitUtil.to(recordExtension, 4); if (currentRecord > 0 && currentRecord <= mergeRecordCount) { - position = positions.remove(positions.size() - 1); + if (positions.size() == 0) { + getLastLocation(position, null); + } else { + position = positions.remove(positions.size() - 1); + } } } @@ -388,7 +393,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { return null; - } else if (type == MSG_IDENTIFICATION) { + } else if (type == MSG_IDENTIFICATION || type == MSG_HEARTBEAT) { ByteBuf content = Unpooled.buffer(); content.writeByte(1); |