From f757f587aca7491d27f2f536cf402de8cbee1d1e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 30 Sep 2015 22:57:53 +1300 Subject: Fix CalAmp mini report (fix #1430) --- src/org/traccar/protocol/CalAmpProtocolDecoder.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/CalAmpProtocolDecoder.java b/src/org/traccar/protocol/CalAmpProtocolDecoder.java index 4dfb93440..f1cf6ae6f 100644 --- a/src/org/traccar/protocol/CalAmpProtocolDecoder.java +++ b/src/org/traccar/protocol/CalAmpProtocolDecoder.java @@ -62,6 +62,7 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder { } } + @Override protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { @@ -191,9 +192,11 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder { position.set(Event.KEY_STATUS, buf.readUnsignedByte()); } - // Event code and status + // Event code if (type == MSG_EVENT_REPORT || type == MSG_MINI_EVENT_REPORT) { - buf.readUnsignedByte(); + if (type != MSG_MINI_EVENT_REPORT) { + buf.readUnsignedByte(); // event index + } position.set(Event.KEY_EVENT, buf.readUnsignedByte()); } @@ -202,7 +205,9 @@ public class CalAmpProtocolDecoder extends BaseProtocolDecoder { int accType = accCount >> 6; accCount &= 0x3f; - buf.readUnsignedByte(); // reserved + if (type != MSG_MINI_EVENT_REPORT) { + buf.readUnsignedByte(); // reserved + } if (accType == 1) { buf.readUnsignedInt(); // threshold -- cgit v1.2.3