aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/protocol/NavtelecomFrameDecoder.java9
-rw-r--r--src/test/java/org/traccar/protocol/NavtelecomFrameDecoderTest.java3
2 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/NavtelecomFrameDecoder.java b/src/main/java/org/traccar/protocol/NavtelecomFrameDecoder.java
index 0fb82528b..2ab7d11a9 100644
--- a/src/main/java/org/traccar/protocol/NavtelecomFrameDecoder.java
+++ b/src/main/java/org/traccar/protocol/NavtelecomFrameDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ * Copyright 2021 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,12 @@ public class NavtelecomFrameDecoder extends BaseFrameDecoder {
protected Object decode(
ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception {
- if (buf.getByte(buf.readerIndex()) == '@') {
+ if (buf.getByte(buf.readerIndex()) == 0x7f) {
+
+ buf.skipBytes(1);
+ return null;
+
+ } else if (buf.getByte(buf.readerIndex()) == '@') {
int length = buf.getUnsignedShortLE(12) + 12 + 2 + 2;
if (buf.readableBytes() >= length) {
diff --git a/src/test/java/org/traccar/protocol/NavtelecomFrameDecoderTest.java b/src/test/java/org/traccar/protocol/NavtelecomFrameDecoderTest.java
index 07b19651b..562b220d4 100644
--- a/src/test/java/org/traccar/protocol/NavtelecomFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NavtelecomFrameDecoderTest.java
@@ -19,6 +19,9 @@ public class NavtelecomFrameDecoderTest extends ProtocolTest {
binary("404e544301000000000000002a005e6c2a3e464c4558b01e1efffffe300a08080ffffe08000000580028002bc0000000000000b4000000000000"),
decoder.decode(null, null, binary("404e544301000000000000002a005e6c2a3e464c4558b01e1efffffe300a08080ffffe08000000580028002bc0000000000000b4000000000000")));
+ verifyNull(
+ decoder.decode(null, null, binary("7f")));
+
}
@Ignore