diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-08 15:05:44 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-08 15:05:44 +1300 |
commit | 9feb2168fda27b89b20f5c1cac68547107a8589d (patch) | |
tree | 2ec633a74b38b725187a643ef2847c6f7c8c4714 /src/org/traccar/protocol/RuptelaProtocolDecoder.java | |
parent | 38134454c55b4a36f7c82686e3a29a9610050e6e (diff) | |
download | trackermap-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/RuptelaProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/RuptelaProtocolDecoder.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/org/traccar/protocol/RuptelaProtocolDecoder.java index 45925d5d1..ede92d837 100644 --- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java +++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java @@ -37,14 +37,12 @@ public class RuptelaProtocolDecoder 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; buf.readUnsignedShort(); // data length - // Identify device String imei = String.format("%015d", buf.readLong()); if (!identify(imei, channel)) { return null; @@ -63,19 +61,16 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(getDeviceId()); - // Time position.setTime(new Date(buf.readUnsignedInt() * 1000)); buf.readUnsignedByte(); // timestamp extension buf.readUnsignedByte(); // priority (reserved) - // Location position.setLongitude(buf.readInt() / 10000000.0); position.setLatitude(buf.readInt() / 10000000.0); position.setAltitude(buf.readUnsignedShort() / 10.0); position.setCourse(buf.readUnsignedShort() / 100.0); - // Validity int satellites = buf.readUnsignedByte(); position.set(Event.KEY_SATELLITES, satellites); position.setValid(satellites >= 3); @@ -109,13 +104,13 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { for (int j = 0; j < cnt; j++) { position.set(Event.PREFIX_IO + buf.readUnsignedByte(), buf.readLong()); } + positions.add(position); } - // Acknowledgement if (channel != null) { byte[] response = {0x00, 0x02, 0x64, 0x01, 0x13, (byte) 0xbc}; - channel.write(ChannelBuffers.wrappedBuffer(response)); + channel.write(ChannelBuffers.wrappedBuffer(response)); // acknowledgement } return positions; |