aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-01 08:54:27 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-01 08:54:27 +1300
commitc35dcf705127726f266d4b31572d2494e00d627b (patch)
treecd8765039d419aee6fa699c092e545e0ff299adb /src/org/traccar/protocol
parentb4fb0f86ac1825f10922c8df1a0efb5b5f5e6514 (diff)
downloadtrackermap-server-c35dcf705127726f266d4b31572d2494e00d627b.tar.gz
trackermap-server-c35dcf705127726f266d4b31572d2494e00d627b.tar.bz2
trackermap-server-c35dcf705127726f266d4b31572d2494e00d627b.zip
Decode heartbeat Castel position
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/CastelProtocolDecoder.java30
1 files changed, 15 insertions, 15 deletions
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<Position> positions = new LinkedList<>();
+ buf.readUnsignedByte(); // 0x01 for history
+ int count = buf.readUnsignedByte();
+
+ List<Position> 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;
}