From f159a96647c091f2234db6ad84203735251598c8 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 26 Oct 2023 20:11:54 -0700 Subject: Fix data length --- src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java index b0e793a43..1455519e5 100644 --- a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java @@ -63,11 +63,12 @@ public class DualcamProtocolDecoder extends BaseProtocolDecoder { int type = buf.readUnsignedShort(); + DeviceSession deviceSession; switch (type) { case MSG_INIT: buf.readUnsignedShort(); // protocol id uniqueId = String.valueOf(buf.readLong()); - DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, uniqueId); + deviceSession = getDeviceSession(channel, remoteAddress, uniqueId); long settings = buf.readUnsignedInt(); if (channel != null && deviceSession != null) { ByteBuf response = Unpooled.buffer(); @@ -113,7 +114,7 @@ public class DualcamProtocolDecoder extends BaseProtocolDecoder { } break; case MSG_DATA: - int length = buf.readUnsignedShort(); + int length = buf.readUnsignedShort() - 2; media.writeBytes(buf, length); boolean finished; if (isPacketData()) { -- cgit v1.2.3