From 5b4ab0d3fb7a04ddb3b062159329dd258137ac62 Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Mon, 28 Jan 2019 23:49:31 +0300 Subject: Minor fix for message type parser --- src/org/traccar/protocol/NavisProtocolDecoder.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java index decfae63f..582eccf3a 100644 --- a/src/org/traccar/protocol/NavisProtocolDecoder.java +++ b/src/org/traccar/protocol/NavisProtocolDecoder.java @@ -693,6 +693,11 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { private Object decodeFlex(Channel channel, SocketAddress remoteAddress, ByteBuf buf) { + if (buf.getByte(buf.readerIndex()) == 0x7F) { + // Keep alive message + return null; + } + String type = buf.toString(buf.readerIndex(), 2, StandardCharsets.US_ASCII); buf.skipBytes(type.length()); @@ -728,11 +733,6 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { ByteBuf buf = (ByteBuf) msg; - if (buf.getByte(buf.readerIndex()) == 0x7F) { - // FLEX keep alive message - return null; - } - if (flexDataSize > 0) { return decodeFlex(channel, remoteAddress, buf); } else { -- cgit v1.2.3