aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-06-27 06:48:31 -0700
committerAnton Tananaev <anton@traccar.org>2024-06-27 06:48:31 -0700
commit90e5c5a7ede05d5d06abda6474d593b5a7843c9e (patch)
treecd6156fa0599a377f91005f6b3cc36c188fd1fc4
parentb13e4dafc64f4531370ffd73121f4d769d161311 (diff)
downloadtrackermap-server-90e5c5a7ede05d5d06abda6474d593b5a7843c9e.tar.gz
trackermap-server-90e5c5a7ede05d5d06abda6474d593b5a7843c9e.tar.bz2
trackermap-server-90e5c5a7ede05d5d06abda6474d593b5a7843c9e.zip
Do not respond to TRV responses
-rw-r--r--src/main/java/org/traccar/protocol/TrvProtocolDecoder.java2
-rw-r--r--src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/TrvProtocolDecoder.java b/src/main/java/org/traccar/protocol/TrvProtocolDecoder.java
index 1187250f8..7f298c8cf 100644
--- a/src/main/java/org/traccar/protocol/TrvProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TrvProtocolDecoder.java
@@ -180,7 +180,7 @@ public class TrvProtocolDecoder extends BaseProtocolDecoder {
channel.writeAndFlush(new NetworkMessage(responseHeader + "," + time + ",0#", remoteAddress));
} else if (type.equals("AP14")) {
channel.writeAndFlush(new NetworkMessage(responseHeader + ",0.000,0.000#", remoteAddress));
- } else {
+ } else if (!sentence.substring(responseHeader.length() + 1).matches("^\\d{6}$")) {
channel.writeAndFlush(new NetworkMessage(responseHeader + "#", remoteAddress));
}
}
diff --git a/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java
index a17fc341f..2757064e4 100644
--- a/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java
@@ -14,6 +14,9 @@ public class TrvProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, text(
"TRVAP00352121088015548"));
+ verifyNull(decoder, text(
+ "IWAPXL,080835"));
+
verifyAttribute(decoder, text(
"IWAP10080524A2232.9806N11404.9355E000.1061830323.8706000908000502,460,0,9520,3671,01,zhcn,00,HOME|74-DE-2B-44-88-8C|97&HOME1|74-DE-2B-44-88-8C|97&HOME2|74-DE-2B-44-88-8C|97&HOME3|74-DE-2B-44-88-8C|97"),
Position.KEY_ALARM, Position.ALARM_SOS);