aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/KhdProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-20 11:25:37 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-20 11:25:37 +1300
commit7b103b43754de283e423df03042c6f75307c8466 (patch)
treecfafeac3703855d065bac9139613a0884445f73e /src/org/traccar/protocol/KhdProtocolDecoder.java
parentbfaa57707b8a9d9dc122e139a06b3632a749c628 (diff)
downloadtrackermap-server-7b103b43754de283e423df03042c6f75307c8466.tar.gz
trackermap-server-7b103b43754de283e423df03042c6f75307c8466.tar.bz2
trackermap-server-7b103b43754de283e423df03042c6f75307c8466.zip
Fix more check style issues
Diffstat (limited to 'src/org/traccar/protocol/KhdProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/KhdProtocolDecoder.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java
index da41daa0e..1ae192bf5 100644
--- a/src/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/org/traccar/protocol/KhdProtocolDecoder.java
@@ -36,8 +36,14 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
private String readSerialNumber(ChannelBuffer buf) {
int b1 = buf.readUnsignedByte();
- int b2 = buf.readUnsignedByte(); if (b2 > 0x80) b2 -= 0x80;
- int b3 = buf.readUnsignedByte(); if (b3 > 0x80) b3 -= 0x80;
+ int b2 = buf.readUnsignedByte();
+ if (b2 > 0x80) {
+ b2 -= 0x80;
+ }
+ int b3 = buf.readUnsignedByte();
+ if (b3 > 0x80) {
+ b3 -= 0x80;
+ }
int b4 = buf.readUnsignedByte();
String serialNumber = String.format("%02d%02d%02d%02d", b1, b2, b3, b4);
return String.valueOf(Long.parseLong(serialNumber));
@@ -63,12 +69,8 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
int type = buf.readUnsignedByte();
buf.readUnsignedShort(); // size
- if (type == MSG_ON_DEMAND ||
- type == MSG_POSITION_UPLOAD ||
- type == MSG_POSITION_REUPLOAD ||
- type == MSG_ALARM ||
- type == MSG_REPLY ||
- type == MSG_PERIPHERAL) {
+ if (type == MSG_ON_DEMAND || type == MSG_POSITION_UPLOAD || type == MSG_POSITION_REUPLOAD
+ || type == MSG_ALARM || type == MSG_REPLY || type == MSG_PERIPHERAL) {
// Create new position
Position position = new Position();
@@ -118,7 +120,8 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
}
- // TODO: parse extra data
+ // parse extra data
+
return position;
} else if (type == MSG_LOGIN && channel != null) {