From 55a3404dd2d82666af8fe4fdfb81212874215879 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 6 Oct 2016 06:40:39 +1300 Subject: Fix problem with Ulbotech decoder --- src/org/traccar/protocol/UlbotechProtocolDecoder.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java index 9a951f770..ff41c9cc4 100644 --- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java +++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java @@ -55,7 +55,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder { private static final short DATA_RFID = 0x0E; private static final short DATA_EVENT = 0x10; - private void decodeObd(Position position, ChannelBuffer buf, short length) { + private void decodeObd(Position position, ChannelBuffer buf, int length) { int end = buf.readerIndex() + length; @@ -66,7 +66,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder { } } - private void decodeJ1708(Position position, ChannelBuffer buf, short length) { + private void decodeJ1708(Position position, ChannelBuffer buf, int length) { int end = buf.readerIndex() + length; @@ -166,8 +166,8 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder { while (buf.readableBytes() > 3) { - short type = buf.readUnsignedByte(); - short length = buf.readUnsignedByte(); + int type = buf.readUnsignedByte(); + int length = type == DATA_CANBUS ? buf.readUnsignedShort() : buf.readUnsignedByte(); switch (type) { -- cgit v1.2.3