diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-14 11:27:29 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-14 11:27:29 +1300 |
commit | 503e44d8484fcbc61a341f35e7900def94553106 (patch) | |
tree | 3ba95c99912ab53ad2787e93258c8edbe23ac2c4 /src/org/traccar/protocol/CastelProtocolDecoder.java | |
parent | 766064092ca4f85eacfa741e1ff772ea5b981d1a (diff) | |
download | trackermap-server-503e44d8484fcbc61a341f35e7900def94553106.tar.gz trackermap-server-503e44d8484fcbc61a341f35e7900def94553106.tar.bz2 trackermap-server-503e44d8484fcbc61a341f35e7900def94553106.zip |
More check style issues clean up
Diffstat (limited to 'src/org/traccar/protocol/CastelProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/CastelProtocolDecoder.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index dcfa2868b..fe8d0a525 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -67,8 +67,14 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { position.setCourse(buf.readUnsignedShort() % 360); int flags = buf.readUnsignedByte(); - position.setLatitude((flags & 0x02) == 0 ? -lat : lat); - position.setLongitude((flags & 0x01) == 0 ? -lon : lon); + if ((flags & 0x02) == 0) { + lat = -lat; + } + if ((flags & 0x01) == 0) { + lon = -lon; + } + position.setLatitude(lat); + position.setLongitude(lon); position.setValid((flags & 0x0C) > 0); position.set(Event.KEY_SATELLITES, flags >> 4); } @@ -95,17 +101,14 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { response.writeByte(version); response.writeBytes(id); response.writeShort(ChannelBuffers.swapShort(MSG_HEARTBEAT_RESPONSE)); - response.writeShort(Checksum.crc16(Checksum.CRC16_X25, response.toByteBuffer(0, response.writerIndex()))); + response.writeShort( + Checksum.crc16(Checksum.CRC16_X25, response.toByteBuffer(0, response.writerIndex()))); response.writeByte(0x0D); response.writeByte(0x0A); channel.write(response, remoteAddress); } - } else if ( - type == MSG_LOGIN || - type == MSG_LOGOUT || - type == MSG_GPS || - type == MSG_ALARM || - type == MSG_CURRENT_LOCATION) { + } else if (type == MSG_LOGIN || type == MSG_LOGOUT || type == MSG_GPS + || type == MSG_ALARM || type == MSG_CURRENT_LOCATION) { if (!identify(id.toString(Charset.defaultCharset()).trim(), channel, remoteAddress)) { @@ -122,7 +125,8 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { response.writeInt(0xFFFFFFFF); response.writeShort(0); response.writeInt((int) (System.currentTimeMillis() / 1000)); - response.writeShort(Checksum.crc16(Checksum.CRC16_X25, response.toByteBuffer(0, response.writerIndex()))); + response.writeShort( + Checksum.crc16(Checksum.CRC16_X25, response.toByteBuffer(0, response.writerIndex()))); response.writeByte(0x0D); response.writeByte(0x0A); channel.write(response, remoteAddress); |