diff options
author | Anton Tananaev <anton@traccar.org> | 2023-10-26 20:11:54 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-10-26 20:11:54 -0700 |
commit | f159a96647c091f2234db6ad84203735251598c8 (patch) | |
tree | fc5d4f96df03bbbf8dc7ff937854b8d5187b7a67 /src/main | |
parent | 74ead779cd0b275620ffd399bac7b57f4bc02deb (diff) | |
download | trackermap-server-f159a96647c091f2234db6ad84203735251598c8.tar.gz trackermap-server-f159a96647c091f2234db6ad84203735251598c8.tar.bz2 trackermap-server-f159a96647c091f2234db6ad84203735251598c8.zip |
Fix data length
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java | 5 |
1 files changed, 3 insertions, 2 deletions
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()) { |