diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java index 51b32ae3e..14f32a3ec 100644 --- a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java @@ -72,8 +72,13 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder { ByteBuf buf = (ByteBuf) msg; buf.readUnsignedByte(); // header + int flags = buf.readUnsignedByte(); + buf.readUnsignedShortLE(); // length + buf.readUnsignedShortLE(); // checksum + int index = buf.readUnsignedShortLE(); + int type = buf.readUnsignedByte(); - if (BitUtil.check(buf.readUnsignedByte(), 4) && channel != null) { + if (BitUtil.check(flags, 4) && channel != null) { ByteBuf content = Unpooled.buffer(); content.writeByte(MSG_RESPONSE); @@ -82,21 +87,16 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder { ByteBuf response = Unpooled.buffer(); response.writeByte(0xAB); // header - response.writeByte(0); // properties - response.writeShortLE(3); + response.writeByte(0x28); // properties + response.writeShortLE(content.readableBytes()); response.writeShortLE(Checksum.crc16(Checksum.CRC16_XMODEM, content.nioBuffer())); - response.writeShortLE(0); // index + response.writeShortLE(index); response.writeBytes(content); content.release(); channel.writeAndFlush(new NetworkMessage(response, remoteAddress)); } - buf.readUnsignedShortLE(); // length - buf.readUnsignedShortLE(); // checksum - buf.readUnsignedShortLE(); // index - int type = buf.readUnsignedByte(); - if (type == MSG_DATA) { Position position = new Position(getProtocolName()); |