diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-12-09 22:58:21 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-12-09 22:58:21 +1300 |
commit | a991edb432d81a4b5983b78a04e8f8ac9d4d6538 (patch) | |
tree | 219d65a67b53d56e4b3215f238994c6f817d3f1d | |
parent | 60a58d0c52725892a812a87a11cb2ad3a5d3e73b (diff) | |
download | trackermap-server-a991edb432d81a4b5983b78a04e8f8ac9d4d6538.tar.gz trackermap-server-a991edb432d81a4b5983b78a04e8f8ac9d4d6538.tar.bz2 trackermap-server-a991edb432d81a4b5983b78a04e8f8ac9d4d6538.zip |
Fix code style issues
-rw-r--r-- | src/org/traccar/protocol/FlespiProtocolDecoder.java | 4 | ||||
-rw-r--r-- | src/org/traccar/protocol/Gl200TextProtocolDecoder.java | 6 | ||||
-rw-r--r-- | src/org/traccar/protocol/T55ProtocolDecoder.java | 9 |
3 files changed, 8 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/FlespiProtocolDecoder.java b/src/org/traccar/protocol/FlespiProtocolDecoder.java index 5c0670d74..e86a7c607 100644 --- a/src/org/traccar/protocol/FlespiProtocolDecoder.java +++ b/src/org/traccar/protocol/FlespiProtocolDecoder.java @@ -104,7 +104,7 @@ public class FlespiProtocolDecoder extends BaseHttpProtocolDecoder { private boolean decodeParam(String name, int index, JsonValue value, Position position) { switch (name) { case "timestamp": - position.setTime(new Date((((JsonNumber) value).longValue() * 1000))); + position.setTime(new Date(((JsonNumber) value).longValue() * 1000)); return true; case "position.latitude": position.setLatitude(((JsonNumber) value).doubleValue()); @@ -140,7 +140,7 @@ public class FlespiProtocolDecoder extends BaseHttpProtocolDecoder { if (position.getInteger(key) == 0) { position.set(key, 1 << (index - 1)); } else { - position.set(key, (position.getInteger(key) | 1 << (index - 1))); + position.set(key, position.getInteger(key) | 1 << (index - 1)); } } return true; diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java index fb0023dba..d7468e71d 100644 --- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -575,10 +575,8 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(reportMask, 9)) { index += 1; // range } - if (BitUtil.check(reportMask, 10)) { - if (!values[index++].isEmpty()) { - position.set(Position.KEY_THROTTLE, Integer.parseInt(values[index - 1])); - } + if (BitUtil.check(reportMask, 10) && !values[index++].isEmpty()) { + position.set(Position.KEY_THROTTLE, Integer.parseInt(values[index - 1])); } if (BitUtil.check(reportMask, 11)) { position.set(Position.KEY_HOURS, Double.parseDouble(values[index++])); diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index 6b4ee6ebd..bfddf74ac 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -99,11 +99,10 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { private Position decodeGprmc( DeviceSession deviceSession, String sentence, SocketAddress remoteAddress, Channel channel) { - if (deviceSession != null && channel != null && !(channel instanceof DatagramChannel)) { - if (Context.getIdentityManager().lookupAttributeBoolean( - deviceSession.getDeviceId(), getProtocolName() + ".ack", false, true)) { - channel.write("OK1\r\n"); - } + if (deviceSession != null && channel != null && !(channel instanceof DatagramChannel) + && Context.getIdentityManager().lookupAttributeBoolean( + deviceSession.getDeviceId(), getProtocolName() + ".ack", false, true)) { + channel.write("OK1\r\n"); } Parser parser = new Parser(PATTERN_GPRMC, sentence); |