aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/EelinkProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-08 15:05:44 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-08 15:05:44 +1300
commit9feb2168fda27b89b20f5c1cac68547107a8589d (patch)
tree2ec633a74b38b725187a643ef2847c6f7c8c4714 /src/org/traccar/protocol/EelinkProtocolDecoder.java
parent38134454c55b4a36f7c82686e3a29a9610050e6e (diff)
downloadtrackermap-server-9feb2168fda27b89b20f5c1cac68547107a8589d.tar.gz
trackermap-server-9feb2168fda27b89b20f5c1cac68547107a8589d.tar.bz2
trackermap-server-9feb2168fda27b89b20f5c1cac68547107a8589d.zip
Clean up Java code formatting
Diffstat (limited to 'src/org/traccar/protocol/EelinkProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index 0106e6049..6d77abc1b 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -54,8 +54,7 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
@Override
protected Object decode(
- Channel channel, SocketAddress remoteAddress, Object msg)
- throws Exception {
+ Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
ChannelBuffer buf = (ChannelBuffer) msg;
@@ -75,24 +74,20 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
} else if (hasDeviceId()
&& (type == MSG_GPS || type == MSG_ALARM || type == MSG_STATE || type == MSG_SMS)) {
- // Create new position
Position position = new Position();
position.setDeviceId(getDeviceId());
position.setProtocol(getProtocolName());
position.set(Event.KEY_INDEX, index);
- // Location
position.setTime(new Date(buf.readUnsignedInt() * 1000));
position.setLatitude(buf.readInt() / 1800000.0);
position.setLongitude(buf.readInt() / 1800000.0);
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
position.setCourse(buf.readUnsignedShort());
- // Cell
position.set(Event.KEY_CELL, ChannelBuffers.hexDump(buf.readBytes(9)));
- // Validity
position.setValid((buf.readUnsignedByte() & 0x01) != 0);
if (type == MSG_ALARM) {
@@ -102,7 +97,9 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_STATE) {
position.set(Event.KEY_STATUS, buf.readUnsignedByte());
}
+
return position;
+
}
return null;