diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-04 13:20:46 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-04 13:20:46 +1300 |
commit | d4dbf85d9536bfec85252a58fc552e2bad42ff17 (patch) | |
tree | 4a849426c2cd60538b152138b147abef47b40966 /src/org/traccar/protocol/TaipProtocolDecoder.java | |
parent | 9218bc65b9673b24d2866aae3d5bbe1a5388bab0 (diff) | |
download | trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.tar.gz trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.tar.bz2 trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.zip |
Remove trailing whitespaces from code
Diffstat (limited to 'src/org/traccar/protocol/TaipProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/TaipProtocolDecoder.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/TaipProtocolDecoder.java b/src/org/traccar/protocol/TaipProtocolDecoder.java index 252f4e712..180be3268 100644 --- a/src/org/traccar/protocol/TaipProtocolDecoder.java +++ b/src/org/traccar/protocol/TaipProtocolDecoder.java @@ -16,7 +16,7 @@ package org.traccar.protocol; import java.net.SocketAddress; -import java.util.Calendar; +import java.util.Calendar; import java.util.Date; import java.util.TimeZone; import java.util.regex.Matcher; @@ -29,7 +29,7 @@ import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; public class TaipProtocolDecoder extends BaseProtocolDecoder { - + private final boolean sendResponse; public TaipProtocolDecoder(TaipProtocol protocol, boolean sendResponse) { @@ -65,18 +65,18 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { return new Date(millis); } - + private Date getTime(long seconds) { Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.set(Calendar.HOUR_OF_DAY, 0); time.set(Calendar.MINUTE, 0); time.set(Calendar.SECOND, 0); time.set(Calendar.MILLISECOND, 0); - + long millis = time.getTimeInMillis() + seconds * 1000; - + long diff = System.currentTimeMillis() - millis; - + if (diff > 12 * 60 * 60 * 1000) { millis += 24 * 60 * 60 * 1000; } else if (diff < -12 * 60 * 60 * 1000) { @@ -85,14 +85,14 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { return new Date(millis); } - + @Override protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { String sentence = (String) msg; - + // Find message start int beginIndex = sentence.indexOf('>'); if (beginIndex != -1) { @@ -134,7 +134,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDeviceId()); Integer index = 1; - + // Time String week = parser.group(index++); String day = parser.group(index++); @@ -167,11 +167,11 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder { String longitude = parser.group(index) + '.' + parser.group(index + 1); index += 2; position.setLongitude(Double.valueOf(longitude)); - + // Speed and Course position.setSpeed(UnitsConverter.knotsFromMph(Double.valueOf(parser.group(index++)))); position.setCourse(Double.valueOf(parser.group(index++))); - + // Validity position.setValid(Integer.valueOf(parser.group(index++)) != 0); return position; |