diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-13 13:17:35 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-13 13:17:35 +1300 |
commit | 74c93c7cef8fe3ef53ba17b3c9da7b374003d042 (patch) | |
tree | 037d01c8c27f83d07c7f5704c75b226c48257930 | |
parent | 387b6286e543c830bf61b4b0e107e9ef4c7eb53d (diff) | |
download | traccar-server-74c93c7cef8fe3ef53ba17b3c9da7b374003d042.tar.gz traccar-server-74c93c7cef8fe3ef53ba17b3c9da7b374003d042.tar.bz2 traccar-server-74c93c7cef8fe3ef53ba17b3c9da7b374003d042.zip |
Fix minor style issues in Meiligao
-rw-r--r-- | src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index 67330cca4..7e2aa062d 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -18,9 +18,6 @@ package org.traccar.protocol; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.nio.charset.Charset; -import java.util.Calendar; -import java.util.TimeZone; -import java.util.regex.Matcher; import java.util.regex.Pattern; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; @@ -90,12 +87,16 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { // First digit int d1 = (b & 0xf0) >> 4; - if (d1 == 0xf) break; + if (d1 == 0xf) { + break; + } builder.append(d1); // Second digit int d2 = b & 0x0f; - if (d2 == 0xf) break; + if (d2 == 0xf) { + break; + } builder.append(d2); } @@ -210,8 +211,14 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { } } - Parser parser = new Parser(command == MSG_RFID ? PATTERN_RFID : PATTERN, - buf.toString(buf.readerIndex(), buf.readableBytes() - 4, Charset.defaultCharset())); + Pattern pattern; + if (command == MSG_RFID) { + pattern = PATTERN_RFID; + } else { + pattern = PATTERN; + } + + Parser parser = new Parser(pattern, buf.toString(buf.readerIndex(), buf.readableBytes() - 4, Charset.defaultCharset())); if (!parser.matches()) { return null; } |