diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-04 13:20:46 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-04 13:20:46 +1300 |
commit | d4dbf85d9536bfec85252a58fc552e2bad42ff17 (patch) | |
tree | 4a849426c2cd60538b152138b147abef47b40966 /src/org/traccar/protocol/TzoneProtocolDecoder.java | |
parent | 9218bc65b9673b24d2866aae3d5bbe1a5388bab0 (diff) | |
download | trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.tar.gz trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.tar.bz2 trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.zip |
Remove trailing whitespaces from code
Diffstat (limited to 'src/org/traccar/protocol/TzoneProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/TzoneProtocolDecoder.java | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/org/traccar/protocol/TzoneProtocolDecoder.java b/src/org/traccar/protocol/TzoneProtocolDecoder.java index ed463c109..1fe32af7a 100644 --- a/src/org/traccar/protocol/TzoneProtocolDecoder.java +++ b/src/org/traccar/protocol/TzoneProtocolDecoder.java @@ -46,32 +46,32 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder { } buf.readUnsignedShort(); // model buf.readUnsignedInt(); // firmware - + String imei = ChannelBufferTools.readHexString(buf, 16).substring(1); if (!identify(imei, channel)) { return null; } - + buf.skipBytes(6); // device time Position position = new Position(); position.setProtocol(getProtocolName()); position.setDeviceId(getDeviceId()); - + // GPS info int blockLength = buf.readUnsignedShort(); int blockEnd = buf.readerIndex() + blockLength; - + if (blockLength == 0) { return null; } - + position.set(Event.KEY_SATELLITES, buf.readUnsignedByte()); - + double lat = buf.readUnsignedInt() / 600000.0; double lon = buf.readUnsignedInt() / 600000.0; - + Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); time.set(Calendar.YEAR, 2000 + buf.readUnsignedByte()); @@ -81,40 +81,40 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.MINUTE, buf.readUnsignedByte()); time.set(Calendar.SECOND, buf.readUnsignedByte()); position.setTime(time.getTime()); - + position.setSpeed(buf.readUnsignedShort() * 0.01); - + position.set(Event.KEY_ODOMETER, buf.readUnsignedMedium()); - + int flags = buf.readUnsignedShort(); position.setCourse(BitUtil.range(flags, 0, 9)); position.setLatitude(BitUtil.check(flags, 10) ? lat : -lat); position.setLongitude(BitUtil.check(flags, 9) ? -lon : lon); position.setValid(BitUtil.check(flags, 11)); - + buf.readerIndex(blockEnd); - + // LBS info - + blockLength = buf.readUnsignedShort(); blockEnd = buf.readerIndex() + blockLength; - + if (blockLength > 0) { - + position.set(Event.KEY_LAC, buf.readUnsignedShort()); position.set(Event.KEY_CELL, buf.readUnsignedShort()); - + } - + buf.readerIndex(blockEnd); - + // Status info - + blockLength = buf.readUnsignedShort(); blockEnd = buf.readerIndex() + blockLength; - + if (blockLength > 0) { - + position.set(Event.KEY_ALARM, buf.readUnsignedByte()); buf.readUnsignedByte(); // terminal info position.set(Event.PREFIX_IO + 1, buf.readUnsignedShort()); @@ -125,26 +125,26 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder { position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort()); position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort()); position.set(Event.PREFIX_TEMP + 1, buf.readUnsignedShort()); - + } - + buf.readerIndex(blockEnd); - + // Cards - + int index = 1; for (int i = 0; i < 4; i++) { - + blockLength = buf.readUnsignedShort(); blockEnd = buf.readerIndex() + blockLength; - + if (blockLength > 0) { - + int count = buf.readUnsignedByte(); for (int j = 0; j < count; j++) { int length = buf.readUnsignedByte(); - + boolean odd = length % 2 != 0; String num = ChannelBufferTools.readHexString(buf, odd ? length + 1 : length); @@ -154,34 +154,34 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder { } position.set("card" + index, num); - + } } - + buf.readerIndex(blockEnd); - + } - + // Temperature - + buf.skipBytes(buf.readUnsignedShort()); - + // Lock - + buf.skipBytes(buf.readUnsignedShort()); // Passengers - + blockLength = buf.readUnsignedShort(); blockEnd = buf.readerIndex() + blockLength; - + if (blockLength > 0) { - + position.set("passengers-on", buf.readUnsignedMedium()); position.set("passengers-off", buf.readUnsignedMedium()); - + } - + buf.readerIndex(blockEnd); return position; |