aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/FlespiProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java9
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);