From c35dcf705127726f266d4b31572d2494e00d627b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 1 Nov 2015 08:54:27 +1300 Subject: Decode heartbeat Castel position --- .../traccar/protocol/CastelProtocolDecoder.java | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index 09d314dae..bf82bede1 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -183,26 +183,26 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { sendResponse(channel, remoteAddress, version, id, MSG_CC_HEARTBEAT_RESPONSE, null); - if (buf.readUnsignedByte() == 0x01) { - int count = buf.readUnsignedByte(); - List positions = new LinkedList<>(); + buf.readUnsignedByte(); // 0x01 for history + int count = buf.readUnsignedByte(); + + List positions = new LinkedList<>(); - for (int i = 0; i < count; i++) { - Position position = readPosition(buf); + for (int i = 0; i < count; i++) { + Position position = readPosition(buf); - position.set(Event.KEY_STATUS, buf.readUnsignedInt()); - position.set(Event.KEY_BATTERY, buf.readUnsignedByte()); - position.set(Event.KEY_ODOMETER, buf.readUnsignedInt()); + position.set(Event.KEY_STATUS, buf.readUnsignedInt()); + position.set(Event.KEY_BATTERY, buf.readUnsignedByte()); + position.set(Event.KEY_ODOMETER, buf.readUnsignedInt()); - buf.readUnsignedByte(); // geo-fencing id - buf.readUnsignedByte(); // geo-fencing flags - buf.readUnsignedByte(); // additional flags + buf.readUnsignedByte(); // geo-fencing id + buf.readUnsignedByte(); // geo-fencing flags + buf.readUnsignedByte(); // additional flags - position.set(Event.KEY_LAC, buf.readUnsignedShort()); - position.set(Event.KEY_CELL, buf.readUnsignedShort()); + position.set(Event.KEY_LAC, buf.readUnsignedShort()); + position.set(Event.KEY_CELL, buf.readUnsignedShort()); - positions.add(position); - } + positions.add(position); return positions; } -- cgit v1.2.3