aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/TytanProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 13:20:46 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 13:20:46 +1300
commitd4dbf85d9536bfec85252a58fc552e2bad42ff17 (patch)
tree4a849426c2cd60538b152138b147abef47b40966 /src/org/traccar/protocol/TytanProtocolDecoder.java
parent9218bc65b9673b24d2866aae3d5bbe1a5388bab0 (diff)
downloadtrackermap-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/TytanProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index 0936732c5..a16bd4e4b 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -51,60 +51,60 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
throws Exception {
ChannelBuffer buf = (ChannelBuffer) msg;
-
+
buf.readUnsignedByte(); // protocol
buf.readUnsignedShort(); // length
int index = buf.readUnsignedByte() >> 3;
-
+
if (channel != null) {
ChannelBuffer response = ChannelBuffers.copiedBuffer(
"^" + index, Charset.defaultCharset());
channel.write(response, remoteAddress);
}
-
+
String id = String.valueOf(buf.readUnsignedInt());
if (!identify(id, channel, remoteAddress)) {
return null;
}
List<Position> positions = new LinkedList<>();
-
+
while (buf.readableBytes() > 2) {
-
+
Position position = new Position();
position.setProtocol(getProtocolName());
position.setDeviceId(getDeviceId());
-
+
int end = buf.readerIndex() + buf.readUnsignedByte();
-
+
position.setTime(new Date(buf.readUnsignedInt() * 1000));
-
+
int flags = buf.readUnsignedByte();
position.set(Event.KEY_SATELLITES, BitUtil.range(flags, 2));
position.setValid(BitUtil.range(flags, 0, 2) > 0);
-
+
// Latitude
double lat = buf.readUnsignedMedium();
lat = lat * -180 / 16777216 + 90;
position.setLatitude(lat);
-
+
// Longitude
double lon = buf.readUnsignedMedium();
lon = lon * 360 / 16777216 - 180;
position.setLongitude(lon);
-
+
// Status
flags = buf.readUnsignedByte();
position.set(Event.KEY_IGNITION, BitUtil.check(flags, 0));
position.set(Event.KEY_GSM, BitUtil.range(flags, 2, 3));
position.setCourse((BitUtil.range(flags, 5) * 45 + 180) % 360);
-
+
// Speed
int speed = buf.readUnsignedByte();
if (speed < 250) {
position.setSpeed(UnitsConverter.knotsFromKph(speed));
}
-
+
while (buf.readerIndex() < end) {
int type = buf.readUnsignedByte();
@@ -193,7 +193,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
positions.add(position);
}
-
+
return positions;
}