aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 23:11:23 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-13 23:11:23 +1300
commit398b705820109c1103d915a2fec81fcf70b032cf (patch)
tree659a0483eda19f9c91855197b70fd2a0bfb82a60 /src/org/traccar/protocol
parent2da5669f8bd3f734fa37626c892aebdff7268613 (diff)
downloadtraccar-server-398b705820109c1103d915a2fec81fcf70b032cf.tar.gz
traccar-server-398b705820109c1103d915a2fec81fcf70b032cf.tar.bz2
traccar-server-398b705820109c1103d915a2fec81fcf70b032cf.zip
Fix some check style issues
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/Avl301ProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/BceProtocolDecoder.java16
-rw-r--r--src/org/traccar/protocol/BlackKiteProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/CityeasyProtocolEncoder.java10
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolEncoder.java1
-rw-r--r--src/org/traccar/protocol/GpsGateProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/NavisProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Tk102ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TrackboxProtocolDecoder.java2
9 files changed, 42 insertions, 18 deletions
diff --git a/src/org/traccar/protocol/Avl301ProtocolDecoder.java b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
index 1f1fdd6f8..f0ad97bf8 100644
--- a/src/org/traccar/protocol/Avl301ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
@@ -15,6 +15,9 @@
*/
package org.traccar.protocol;
+import java.net.SocketAddress;
+import java.util.Calendar;
+import java.util.TimeZone;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -22,10 +25,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
-import java.net.SocketAddress;
-import java.util.Calendar;
-import java.util.TimeZone;
-
public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
public Avl301ProtocolDecoder(Avl301Protocol protocol) {
@@ -114,8 +113,12 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
int union = buf.readUnsignedShort();
position.setCourse(union & 0x03FF);
position.setValid((union & 0x1000) != 0);
- if ((union & 0x0400) != 0) latitude = -latitude;
- if ((union & 0x0800) != 0) longitude = -longitude;
+ if ((union & 0x0400) != 0) {
+ latitude = -latitude;
+ }
+ if ((union & 0x0800) != 0) {
+ longitude = -longitude;
+ }
position.setLatitude(latitude);
position.setLongitude(longitude);
diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java
index c6f928aef..31e0868fd 100644
--- a/src/org/traccar/protocol/BceProtocolDecoder.java
+++ b/src/org/traccar/protocol/BceProtocolDecoder.java
@@ -113,10 +113,18 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
}
}
- if (BitUtil.check(mask, 10)) buf.skipBytes(4);
- if (BitUtil.check(mask, 11)) buf.skipBytes(4);
- if (BitUtil.check(mask, 12)) buf.skipBytes(2);
- if (BitUtil.check(mask, 13)) buf.skipBytes(2);
+ if (BitUtil.check(mask, 10)) {
+ buf.skipBytes(4);
+ }
+ if (BitUtil.check(mask, 11)) {
+ buf.skipBytes(4);
+ }
+ if (BitUtil.check(mask, 12)) {
+ buf.skipBytes(2);
+ }
+ if (BitUtil.check(mask, 13)) {
+ buf.skipBytes(2);
+ }
if (BitUtil.check(mask, 14)) {
position.set(Event.KEY_MCC, buf.readUnsignedShort());
diff --git a/src/org/traccar/protocol/BlackKiteProtocolDecoder.java b/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
index 21c7c5b33..6b7a8a971 100644
--- a/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
+++ b/src/org/traccar/protocol/BlackKiteProtocolDecoder.java
@@ -28,8 +28,8 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.helper.Log;
import org.traccar.helper.BitUtil;
+import org.traccar.helper.Log;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -131,14 +131,16 @@ public class BlackKiteProtocolDecoder extends BaseProtocolDecoder {
case TAG_DIGITAL_INPUTS:
int input = buf.readUnsignedShort();
- for (int i = 0; i < 16; i++)
+ for (int i = 0; i < 16; i++) {
position.set(Event.PREFIX_IO + (i + 1), BitUtil.check(input, i));
+ }
break;
case TAG_DIGITAL_OUTPUTS:
int output = buf.readUnsignedShort();
- for (int i = 0; i < 16; i++)
+ for (int i = 0; i < 16; i++) {
position.set(Event.PREFIX_IO + (i + 17), BitUtil.check(output, i));
+ }
break;
case TAG_INPUT_VOLTAGE1:
diff --git a/src/org/traccar/protocol/CityeasyProtocolEncoder.java b/src/org/traccar/protocol/CityeasyProtocolEncoder.java
index 76c4199e1..9c5695001 100644
--- a/src/org/traccar/protocol/CityeasyProtocolEncoder.java
+++ b/src/org/traccar/protocol/CityeasyProtocolEncoder.java
@@ -19,6 +19,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.traccar.BaseProtocolEncoder;
import org.traccar.helper.Checksum;
+import org.traccar.helper.Log;
import org.traccar.model.Command;
public class CityeasyProtocolEncoder extends BaseProtocolEncoder {
@@ -56,9 +57,16 @@ public class CityeasyProtocolEncoder extends BaseProtocolEncoder {
return encodeContent(CityeasyProtocolDecoder.MSG_LOCATION_INTERVAL, content);
case Command.TYPE_SET_TIMEZONE:
int timezone = ((Number) command.getAttributes().get(Command.KEY_TIMEZONE)).intValue();
- content.writeByte(timezone < 0 ? 1 : 0);
+ if (timezone < 0) {
+ content.writeByte(1);
+ } else {
+ content.writeByte(0);
+ }
content.writeShort(Math.abs(timezone) / 60);
return encodeContent(CityeasyProtocolDecoder.MSG_TIMEZONE, content);
+ default:
+ Log.warning(new UnsupportedOperationException(command.getType()));
+ break;
}
return null;
diff --git a/src/org/traccar/protocol/Gps103ProtocolEncoder.java b/src/org/traccar/protocol/Gps103ProtocolEncoder.java
index cb1050be3..9f0df8761 100644
--- a/src/org/traccar/protocol/Gps103ProtocolEncoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolEncoder.java
@@ -60,7 +60,6 @@ public class Gps103ProtocolEncoder extends StringProtocolEncoder implements Stri
default:
Log.warning(new UnsupportedOperationException(command.getType()));
break;
-
}
return null;
diff --git a/src/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
index cdd3f5bb6..5e97a66f8 100644
--- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
@@ -81,7 +81,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder {
}
} else if (sentence.startsWith("$FRVER,")) {
-
+
// Version check
send(channel, "$FRVER,1,0,GpsGate Server 1.0");
diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java
index 39912e420..0af74d70e 100644
--- a/src/org/traccar/protocol/NavisProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavisProtocolDecoder.java
@@ -26,6 +26,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.helper.Log;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -308,6 +309,9 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder {
return processArray(channel, buf);
case "*>S":
return processHandshake(channel, buf);
+ default:
+ Log.warning(new UnsupportedOperationException(type));
+ break;
}
return null;
diff --git a/src/org/traccar/protocol/Tk102ProtocolDecoder.java b/src/org/traccar/protocol/Tk102ProtocolDecoder.java
index c052f09ed..613513f89 100644
--- a/src/org/traccar/protocol/Tk102ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk102ProtocolDecoder.java
@@ -62,7 +62,7 @@ public class Tk102ProtocolDecoder extends BaseProtocolDecoder {
} else if (sentence.startsWith("[#")) {
// TODO: EXIT Send response
-
+
} else if (hasDeviceId()) {
Matcher parser = PATTERN.matcher(sentence);
diff --git a/src/org/traccar/protocol/TrackboxProtocolDecoder.java b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
index 58795d4d3..39b1662ea 100644
--- a/src/org/traccar/protocol/TrackboxProtocolDecoder.java
+++ b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
@@ -63,7 +63,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder {
if (identify(id, channel)) {
sendResponse(channel);
}
-
+
} else {
Matcher parser = PATTERN.matcher(sentence);