From 5a35cad42efb1298ff679acf80cbbce169cc4646 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 27 May 2019 17:58:52 -0700 Subject: Update acknowledgement message --- .../traccar/protocol/Minifinder2ProtocolDecoder.java | 18 +++++++++--------- 1 file 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()); -- cgit v1.2.3