diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-30 22:17:02 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-30 22:17:02 -0700 |
commit | 94d95ebeb1168ff235aa49a24c0ba0ed62b1125b (patch) | |
tree | c443b3ab52b045845d6c4d8149cc31aca8087235 | |
parent | 08d7ce0017f7113f3db961ae19cae7b85e386278 (diff) | |
download | trackermap-server-94d95ebeb1168ff235aa49a24c0ba0ed62b1125b.tar.gz trackermap-server-94d95ebeb1168ff235aa49a24c0ba0ed62b1125b.tar.bz2 trackermap-server-94d95ebeb1168ff235aa49a24c0ba0ed62b1125b.zip |
Ignore keepalive messages
-rw-r--r-- | src/main/java/org/traccar/protocol/UuxProtocolDecoder.java | 5 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/UuxProtocolDecoderTest.java | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/UuxProtocolDecoder.java b/src/main/java/org/traccar/protocol/UuxProtocolDecoder.java index 545784865..1081fa811 100644 --- a/src/main/java/org/traccar/protocol/UuxProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/UuxProtocolDecoder.java @@ -40,6 +40,7 @@ public class UuxProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_IMMOBILIZER = 0x9E; public static final int MSG_ACK = 0xD0; public static final int MSG_NACK = 0xF0; + public static final int MSG_KEEPALIVE = 0xFF; private void sendResponse(Channel channel, int productCode, int protocolVersion, int type) { if (channel != null && BitUtil.check(protocolVersion, 7)) { @@ -71,6 +72,10 @@ public class UuxProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // length int type = buf.readUnsignedByte(); + if (type == MSG_KEEPALIVE) { + return null; + } + String vehicleId = buf.readCharSequence(10, StandardCharsets.US_ASCII).toString(); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, vehicleId); if (deviceSession == null) { diff --git a/src/test/java/org/traccar/protocol/UuxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/UuxProtocolDecoderTest.java index c1acfd740..753063d26 100644 --- a/src/test/java/org/traccar/protocol/UuxProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/UuxProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class UuxProtocolDecoderTest extends ProtocolTest { var decoder = new UuxProtocolDecoder(null); + verifyNull(decoder, binary( + "81910b01ff")); + verifyAttributes(decoder, binary( "81910c5a9031395533443630363631051e061a1e07397079712a000000000000413133333135332e333939304e30333531322e393837324530303031303030303000000200000000001f303036323236303030303030303030300000ffff")); |