From a09654ab3c4b540d1c4c768ad4c7ec7c1404332d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 12 May 2019 22:17:40 -0700 Subject: Support modular messages --- src/main/java/org/traccar/protocol/CellocatorFrameDecoder.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/java/org/traccar/protocol/CellocatorFrameDecoder.java') diff --git a/src/main/java/org/traccar/protocol/CellocatorFrameDecoder.java b/src/main/java/org/traccar/protocol/CellocatorFrameDecoder.java index 7d5499d92..ee2adde6d 100644 --- a/src/main/java/org/traccar/protocol/CellocatorFrameDecoder.java +++ b/src/main/java/org/traccar/protocol/CellocatorFrameDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2013 - 2019 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,11 +46,14 @@ public class CellocatorFrameDecoder extends BaseFrameDecoder { break; case CellocatorProtocolDecoder.MSG_CLIENT_SERIAL: if (buf.readableBytes() >= 19) { - length = 19 + buf.getUnsignedShortLE(16); + length = 19 + buf.getUnsignedShortLE(buf.readerIndex() + 16); } break; case CellocatorProtocolDecoder.MSG_CLIENT_MODULAR: - length = 15 + buf.getUnsignedByte(13); + length = 15 + buf.getUnsignedByte(buf.readerIndex() + 13); + break; + case CellocatorProtocolDecoder.MSG_CLIENT_MODULAR_EXT: + length = 16 + buf.getUnsignedShortLE(buf.readerIndex() + 13); break; default: break; -- cgit v1.2.3