aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-07 18:50:10 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-07 18:50:10 +1300
commitc344d4086bb2179d485c9b25af4d737e26f23221 (patch)
treef937934f07951e0ec8f8281528bd1ba9664c2d3f /src/org
parent4a5961a98b0b6576e4c6553435a70a7bca3f9b44 (diff)
downloadtraccar-server-c344d4086bb2179d485c9b25af4d737e26f23221.tar.gz
traccar-server-c344d4086bb2179d485c9b25af4d737e26f23221.tar.bz2
traccar-server-c344d4086bb2179d485c9b25af4d737e26f23221.zip
Rename pattern to upper case style
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/AquilaProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Ardi01ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/BoxProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/CarTrackProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/CarscopProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/CityeasyProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/EasyTrackProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/EnforaProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Ev603ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/FlextrackProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/FreedomProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Gl100ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/GlobalSatProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/GoSafeProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/GotopProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/GpsGateProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/GpsMarkerProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/GpsmtaProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/HaicomProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/LaipacProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/ManPowerProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/MaxonProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java16
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/MiniFinderProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/MtxProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Pt3000ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Pt502ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/RitiProtocolDecoder.java8
-rw-r--r--src/org/traccar/protocol/SanavProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Stl060ProtocolDecoder.java7
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java16
-rw-r--r--src/org/traccar/protocol/TaipProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/TelikProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Tk102ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java10
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java20
-rw-r--r--src/org/traccar/protocol/Tr20ProtocolDecoder.java10
-rw-r--r--src/org/traccar/protocol/Tr900ProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/TrackboxProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/VisiontekProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/WialonProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/WondexProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java10
-rw-r--r--src/org/traccar/protocol/XirgoProtocolDecoder.java4
-rw-r--r--src/org/traccar/protocol/Xt013ProtocolDecoder.java17
-rw-r--r--src/org/traccar/protocol/YwtProtocolDecoder.java6
56 files changed, 162 insertions, 224 deletions
diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java
index ad85c54c2..b2bbf6f93 100644
--- a/src/org/traccar/protocol/AquilaProtocolDecoder.java
+++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java
@@ -32,7 +32,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$\\$" +
"[^,]+," + // Client
"(\\d+)," + // Device serial number
@@ -73,7 +73,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
index 69146d57e..738af9bb1 100644
--- a/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Ardi01ProtocolDecoder.java
@@ -32,7 +32,7 @@ public class Ardi01ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(\\d+)," + // IMEI
"(\\d{4})(\\d{2})(\\d{2})" + // Date (YYYYMMDD)
"(\\d{2})(\\d{2})(\\d{2})," + // Time (HHMMSS)
@@ -54,7 +54,7 @@ public class Ardi01ProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/BoxProtocolDecoder.java b/src/org/traccar/protocol/BoxProtocolDecoder.java
index 2820bd826..2b122dfa2 100644
--- a/src/org/traccar/protocol/BoxProtocolDecoder.java
+++ b/src/org/traccar/protocol/BoxProtocolDecoder.java
@@ -20,7 +20,6 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.UnitsConverter;
@@ -33,7 +32,7 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"L," +
"(\\d{2})(\\d{2})(\\d{2})" + // Date
"(\\d{2})(\\d{2})(\\d{2})," + // Time
@@ -72,7 +71,7 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
else if (sentence.startsWith("L,") && hasDeviceId()) {
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/CarTrackProtocolDecoder.java b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
index 5596994a1..d9bf27973 100644
--- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
@@ -32,7 +32,7 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$\\$" + // Header
"(\\d+)\\?*" + // Device ID
"&A" +
@@ -61,7 +61,7 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/CarscopProtocolDecoder.java b/src/org/traccar/protocol/CarscopProtocolDecoder.java
index 63ed12a2a..6a23d381d 100644
--- a/src/org/traccar/protocol/CarscopProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarscopProtocolDecoder.java
@@ -31,7 +31,7 @@ public class CarscopProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\*.*" +
"(\\d{2})(\\d{2})(\\d{2})" + // Time (HHMMSS)
"([AV])" + // Validity
@@ -63,7 +63,7 @@ public class CarscopProtocolDecoder extends BaseProtocolDecoder {
}
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/CityeasyProtocolDecoder.java b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
index b08eb6c2d..158d84ea3 100644
--- a/src/org/traccar/protocol/CityeasyProtocolDecoder.java
+++ b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
@@ -35,7 +35,7 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(\\d{4})(\\d{2})(\\d{2})" + // Date
"(\\d{2})(\\d{2})(\\d{2})," + // Time
"([AV])," + // Validity
@@ -82,7 +82,7 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_LOCATION_REPORT || type == MSG_LOCATION_REQUEST) {
String sentence = buf.toString(buf.readerIndex(), buf.readableBytes() - 8, Charset.defaultCharset());
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
index 809850370..21553fa44 100644
--- a/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/EasyTrackProtocolDecoder.java
@@ -31,7 +31,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\*..," + // Manufacturer
"(\\d+)," + // IMEI
"([^,]{2})," + // Command
@@ -64,7 +64,7 @@ public class EasyTrackProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/EnforaProtocolDecoder.java b/src/org/traccar/protocol/EnforaProtocolDecoder.java
index 3e341ea8b..0c0b5afe9 100644
--- a/src/org/traccar/protocol/EnforaProtocolDecoder.java
+++ b/src/org/traccar/protocol/EnforaProtocolDecoder.java
@@ -34,7 +34,7 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"GPRMC," +
"(\\d{2})(\\d{2})(\\d{2}).(\\d+)," + // Time (HHMMSS.SS)
"([AV])," + // Validity
@@ -85,7 +85,7 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder {
String sentence = buf.toString(start, buf.readableBytes() - start, Charset.defaultCharset());
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Ev603ProtocolDecoder.java b/src/org/traccar/protocol/Ev603ProtocolDecoder.java
index 34e961084..5926e8963 100644
--- a/src/org/traccar/protocol/Ev603ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Ev603ProtocolDecoder.java
@@ -21,7 +21,6 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Position;
@@ -32,7 +31,7 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"!.," + // Type
"(\\d{2})/(\\d{2})/(\\d{2})," + // Date dd/mm/YY
"(\\d{2}):(\\d{2}):(\\d{2})," + // Time hh:mm:ss
@@ -57,7 +56,7 @@ public class Ev603ProtocolDecoder extends BaseProtocolDecoder {
} else {
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!hasDeviceId() || !parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/FlextrackProtocolDecoder.java b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
index 6840ba30f..04eed5734 100644
--- a/src/org/traccar/protocol/FlextrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/FlextrackProtocolDecoder.java
@@ -32,13 +32,13 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern patternLogon = Pattern.compile(
+ private static final Pattern PATTERN_LOGON = Pattern.compile(
"(-?\\d+)," + // Index
"LOGON," +
"(\\d+)," + // Node ID
"(\\d+)"); // ICCID
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(-?\\d+)," + // Index
"UNITSTAT," +
"(\\d{4})(\\d{2})(\\d{2})," + // Date (YYYYMMDD)
@@ -76,7 +76,7 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder {
if (sentence.contains("LOGON")) {
- Matcher parser = patternLogon.matcher(sentence);
+ Matcher parser = PATTERN_LOGON.matcher(sentence);
if (!parser.matches()) {
return null;
}
@@ -96,7 +96,7 @@ public class FlextrackProtocolDecoder extends BaseProtocolDecoder {
} else if (sentence.contains("UNITSTAT") && hasDeviceId()) {
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/FreedomProtocolDecoder.java b/src/org/traccar/protocol/FreedomProtocolDecoder.java
index 2c6accd53..95e7abb4a 100644
--- a/src/org/traccar/protocol/FreedomProtocolDecoder.java
+++ b/src/org/traccar/protocol/FreedomProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Position;
@@ -32,7 +30,7 @@ public class FreedomProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"IMEI," +
"(\\d+)," + // IMEI
"(\\d{4}).(\\d{2}).(\\d{2}), " + // Date
@@ -48,7 +46,7 @@ public class FreedomProtocolDecoder extends BaseProtocolDecoder {
throws Exception {
// Parse message
- Matcher parser = pattern.matcher((String) msg);
+ Matcher parser = PATTERN.matcher((String) msg);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
index 3233342c8..db22fdb34 100644
--- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Position;
@@ -32,7 +30,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\+RESP:GT...," +
"(\\d{15})," + // IMEI
"(?:(?:\\d+," + // Number
@@ -66,7 +64,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder {
}
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 88b9669c8..a0417c9bc 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -33,13 +33,13 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern heartbeatPattern = Pattern.compile(
+ private static final Pattern PATTERN_HEARTBEAT = Pattern.compile(
"\\+ACK:GTHBD," +
"([0-9A-Z]{2}\\p{XDigit}{4})," +
".*," +
"(\\p{XDigit}{4})\\$?");
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(?:(?:\\+(?:RESP|BUFF):)|" +
"(?:\\x00?\\x04,\\p{XDigit}{4},[01],))" +
"GT...," +
@@ -93,7 +93,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Handle heartbeat
- Matcher parser = heartbeatPattern.matcher(sentence);
+ Matcher parser = PATTERN_HEARTBEAT.matcher(sentence);
if (parser.matches()) {
if (channel != null) {
channel.write("+SACK:GTHBD," + parser.group(1) + "," + parser.group(2) + "$", remoteAddress);
@@ -102,7 +102,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
}
// Parse message
- parser = pattern.matcher(sentence);
+ parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
index 6f55fceef..617c18b71 100644
--- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
+++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java
@@ -170,7 +170,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
return position;
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$" +
"(\\d+)," + // IMEI
"\\d+," + // mode
@@ -190,7 +190,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder {
private Position decodeAlternative(Channel channel, String sentence) {
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
index 90b2e5bea..225070b26 100644
--- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java
+++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
@@ -31,7 +31,7 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\*[^,]+," +
"(\\d+)," + // IMEI
"(\\d{2})(\\d{2})(\\d{2})" + // Time
@@ -59,7 +59,7 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
}
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/GotopProtocolDecoder.java b/src/org/traccar/protocol/GotopProtocolDecoder.java
index 1f8926bb7..16348cb7f 100644
--- a/src/org/traccar/protocol/GotopProtocolDecoder.java
+++ b/src/org/traccar/protocol/GotopProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
@@ -34,7 +32,7 @@ public class GotopProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(\\d+)," + // IMEI
"[^,]+," + // Type
"([AV])," + // Validity
@@ -54,7 +52,7 @@ public class GotopProtocolDecoder extends BaseProtocolDecoder {
// Parse message
String sentence = (String) msg;
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (sentence.isEmpty() || !parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index cf3264ea8..928c24e12 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -31,7 +31,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"imei:" +
"(\\d+)," + // IMEI
"([^,]+)," + // Alarm
@@ -58,7 +58,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
"([^,;]+)?,?" +
".*");
- private static final Pattern handshakePattern = Pattern.compile("##,imei:(\\d+),A");
+ private static final Pattern PATTERN_HANDSHAKE = Pattern.compile("##,imei:(\\d+),A");
@Override
protected Object decode(
@@ -71,7 +71,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
if (sentence.contains("##")) {
if (channel != null) {
channel.write("LOAD", remoteAddress);
- Matcher handshakeMatcher = handshakePattern.matcher(sentence);
+ Matcher handshakeMatcher = PATTERN_HANDSHAKE.matcher(sentence);
if (handshakeMatcher.matches()) {
identify(handshakeMatcher.group(1), channel);
}
@@ -88,7 +88,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
}
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/GpsGateProtocolDecoder.java b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
index 04d9e37fa..97344673c 100644
--- a/src/org/traccar/protocol/GpsGateProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsGateProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Checksum;
import org.traccar.model.Position;
@@ -33,7 +31,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$GPRMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.?(?:\\d+)?," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
@@ -91,7 +89,7 @@ public class GpsGateProtocolDecoder extends BaseProtocolDecoder {
else if (sentence.startsWith("$GPRMC,") && hasDeviceId()) {
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
index 801ceef0e..c9d9b0cce 100644
--- a/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsMarkerProtocolDecoder.java
@@ -31,7 +31,7 @@ public class GpsMarkerProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$GM" +
"\\d" + // Type
"(?:\\p{XDigit}{2})?" + // Index
@@ -59,7 +59,7 @@ public class GpsMarkerProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
index 003d833ee..134dc6496 100644
--- a/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
+++ b/src/org/traccar/protocol/GpsmtaProtocolDecoder.java
@@ -15,15 +15,14 @@
*/
package org.traccar.protocol;
-import org.jboss.netty.channel.Channel;
-import org.traccar.BaseProtocolDecoder;
-import org.traccar.model.Event;
-import org.traccar.model.Position;
-
import java.net.SocketAddress;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.jboss.netty.channel.Channel;
+import org.traccar.BaseProtocolDecoder;
+import org.traccar.model.Event;
+import org.traccar.model.Position;
public class GpsmtaProtocolDecoder extends BaseProtocolDecoder {
@@ -31,7 +30,7 @@ public class GpsmtaProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(\\d+) " + // UID
"(\\d+) " + // Time
"(\\d+\\.\\d+) " + // Latitude
@@ -52,7 +51,7 @@ public class GpsmtaProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index b3b624231..d8cf762f4 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -106,7 +106,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
return position;
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\*..," + // Manufacturer
"(\\d+)," + // IMEI
"V\\d," + // Version?
@@ -126,7 +126,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
private Position decodeText(String sentence, Channel channel) {
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java
index 8b1097a69..42d806728 100644
--- a/src/org/traccar/protocol/HaicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -33,7 +31,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$GPRS" +
"(\\d+)," + // IMEI
"([^,]+)," + // Version
@@ -60,7 +58,7 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index 7d91256b3..6c5c0f58a 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -33,7 +31,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(?:.+,)?(\\d+)," + // Device Identifier
"(\\d{4})(\\d{2})(\\d{2})" + // Date (YYYYMMDD)
"(\\d{2})(\\d{2})(\\d{2})," + // Time (HHMMSS)
@@ -69,7 +67,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index fd76b888f..e8cfd8631 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -15,16 +15,14 @@
*/
package org.traccar.protocol;
-import java.nio.charset.Charset;
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.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
import org.traccar.model.Event;
@@ -121,7 +119,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
return position;
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\(" +
"([\\d]+)," + // Id
"W01," + // Type
@@ -145,7 +143,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
String message = buf.toString(Charset.defaultCharset());
// Parse message
- Matcher parser = pattern.matcher(message);
+ Matcher parser = PATTERN.matcher(message);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java
index 9962b303d..57cf7d3b3 100644
--- a/src/org/traccar/protocol/LaipacProtocolDecoder.java
+++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.Checksum;
import org.traccar.model.Position;
@@ -33,7 +31,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$AVRMC," +
"([^,]+)," + // Identifier
"(\\d{2})(\\d{2})(\\d{2})," + // Time (HHMMSS)
@@ -63,7 +61,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder {
}
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/ManPowerProtocolDecoder.java b/src/org/traccar/protocol/ManPowerProtocolDecoder.java
index 33d13e663..113215c1b 100644
--- a/src/org/traccar/protocol/ManPowerProtocolDecoder.java
+++ b/src/org/traccar/protocol/ManPowerProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -33,7 +31,7 @@ public class ManPowerProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"simei:" +
"(\\d+)," + // IMEI
"[^,]*,[^,]*," +
@@ -57,7 +55,7 @@ public class ManPowerProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/MaxonProtocolDecoder.java b/src/org/traccar/protocol/MaxonProtocolDecoder.java
index 54177af68..14bf285fc 100644
--- a/src/org/traccar/protocol/MaxonProtocolDecoder.java
+++ b/src/org/traccar/protocol/MaxonProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Position;
@@ -41,7 +39,7 @@ public class MaxonProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$GPRMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.(\\d{2})," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
@@ -54,11 +52,10 @@ public class MaxonProtocolDecoder extends BaseProtocolDecoder {
"(\\d{2})(\\d{2})(\\d{2})" + // Date (DDMMYY)
".+"); // Other (Checksumm)
- private static final Pattern gpfidPattern = Pattern.compile("\\$GPFID,(\\d+)$");
+ private static final Pattern PATTERN_GPFID = Pattern.compile("\\$GPFID,(\\d+)$");
- protected Object decode(
- Channel channel, SocketAddress remoteAddress, Object msg)
- throws Exception {
+ @Override
+ protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
String sentence = (String) msg;
@@ -67,7 +64,7 @@ public class MaxonProtocolDecoder extends BaseProtocolDecoder {
if (sentence.contains("$GPRMC")) {
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
@@ -119,7 +116,7 @@ public class MaxonProtocolDecoder extends BaseProtocolDecoder {
position.setTime(time.getTime());
} else if (sentence.contains("$GPFID") && position != null) {
- Matcher parser = gpfidPattern.matcher(sentence);
+ Matcher parser = PATTERN_GPFID.matcher(sentence);
if (parser.matches()) {
if (!identify(parser.group(1), channel)) {
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index d3d12dd76..37bf5a0d4 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -31,7 +31,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern patternGPRMC = Pattern.compile(
+ private static final Pattern PATTERN_GPRMC = Pattern.compile(
"\\$GPRMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.\\d+," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
@@ -44,7 +44,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
"(\\d{2})(\\d{2})(\\d{2})" + // Date (DDMMYY)
".*"); // Checksum
- private static final Pattern patternSimple = Pattern.compile(
+ private static final Pattern PATTERN_SIMPLE = Pattern.compile(
"[FL]," + // Flag
"([^,]*)," + // Alarm
"imei:(\\d+)," + // IMEI
@@ -57,7 +57,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
"(\\p{XDigit}{4},\\p{XDigit}{4});" + // Location code
".+"); // Checksum
- private static final Pattern patternAlternative = Pattern.compile(
+ private static final Pattern PATTERN_ALTERNATIVE = Pattern.compile(
"(\\d+)," + // MCC
"(\\d+)," + // MNC
"(\\p{XDigit}{4},\\p{XDigit}{4})," + // Location code
@@ -75,7 +75,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
private boolean parseGPRMC(String gprmc, Position position) {
// Parse message
- Matcher parser = patternGPRMC.matcher(gprmc);
+ Matcher parser = PATTERN_GPRMC.matcher(gprmc);
if (!parser.matches()) {
return false;
}
@@ -181,7 +181,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
if (simple) {
- Matcher parser = patternSimple.matcher(status);
+ Matcher parser = PATTERN_SIMPLE.matcher(status);
if (parser.matches()) {
int index = 1;
@@ -225,7 +225,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
} else {
- Matcher parser = patternAlternative.matcher(status);
+ Matcher parser = PATTERN_ALTERNATIVE.matcher(status);
if (!parser.matches()) {
int index = 1;
@@ -255,7 +255,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
return position;
}
- private static final Pattern patternNew = Pattern.compile(
+ private static final Pattern PATTERN_NEW = Pattern.compile(
"\\$MGV\\d{3}," +
"(\\d+)," + // IMEI
"[^,]*," + // Name
@@ -293,7 +293,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
private Position decodeNew(Channel channel, String sentence) {
- Matcher parser = patternNew.matcher(sentence);
+ Matcher parser = PATTERN_NEW.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index 17fd0d0d4..94aabb5eb 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -37,7 +37,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(\\d{2})(\\d{2})(\\d{2})\\.?(\\d+)?," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
"(\\d+)(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
@@ -61,7 +61,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
"(?:\\|(\\p{XDigit}{5,}))?)?)?)?)?" + // RFID
".*");
- private static final Pattern rfidPattern = Pattern.compile(
+ private static final Pattern PATTERN_RFID = Pattern.compile(
"\\|(\\d{2})(\\d{2})(\\d{2})," + // Time (HHMMSS)
"(\\d{2})(\\d{2})(\\d{2})," + // Date (DDMMYY)
"(\\d+)(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
@@ -210,7 +210,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
// Parse message
String sentence = buf.toString(buf.readerIndex(), buf.readableBytes() - 4, Charset.defaultCharset());
- Matcher parser = (command == MSG_RFID ? rfidPattern : pattern).matcher(sentence);
+ Matcher parser = (command == MSG_RFID ? PATTERN_RFID : PATTERN).matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index 6b43d1169..220a0c552 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -15,8 +15,8 @@
*/
package org.traccar.protocol;
-import java.nio.charset.Charset;
import java.net.SocketAddress;
+import java.nio.charset.Charset;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;
@@ -24,10 +24,8 @@ import java.util.List;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
import org.traccar.helper.UnitsConverter;
@@ -40,7 +38,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$\\$." + // Flag
"\\d+," + // Length
"(\\d+)," + // IMEI
@@ -77,7 +75,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
// Parse message
String sentence = buf.toString(Charset.defaultCharset());
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
index 7cdfab3a8..9a3ac836d 100644
--- a/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
+++ b/src/org/traccar/protocol/MiniFinderProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -33,7 +31,7 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"!D," +
"(\\d+)/(\\d+)/(\\d+)," + // Date
"(\\d+):(\\d+):(\\d+)," + // Time
@@ -64,7 +62,7 @@ public class MiniFinderProtocolDecoder extends BaseProtocolDecoder {
else if (sentence.startsWith("!D") && hasDeviceId()) {
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/MtxProtocolDecoder.java b/src/org/traccar/protocol/MtxProtocolDecoder.java
index 989d8540c..95c57e759 100644
--- a/src/org/traccar/protocol/MtxProtocolDecoder.java
+++ b/src/org/traccar/protocol/MtxProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -33,7 +31,7 @@ public class MtxProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"#MTX," +
"(\\d+)," + // IMEI
"(\\d{4})(\\d{2})(\\d{2})," + // Date
@@ -64,7 +62,7 @@ public class MtxProtocolDecoder extends BaseProtocolDecoder {
}
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
index 59a9a0160..f2e0a14bc 100644
--- a/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt3000ProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Position;
@@ -32,7 +30,7 @@ public class Pt3000ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"%(\\d+)," + // IMEI
"\\$GPRMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.?\\d*," + // Time (HHMMSS.SSS)
@@ -54,7 +52,7 @@ public class Pt3000ProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
index 3bd971d23..4027a54b2 100644
--- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -32,7 +32,7 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
".*" +
"\\$[A-Z]{3}\\d?," + // Type
"(\\d+)," + // Id
@@ -62,7 +62,7 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java
index ca7e2a038..bb7c0b583 100644
--- a/src/org/traccar/protocol/RitiProtocolDecoder.java
+++ b/src/org/traccar/protocol/RitiProtocolDecoder.java
@@ -15,16 +15,14 @@
*/
package org.traccar.protocol;
-import java.nio.charset.Charset;
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.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.ChannelBufferTools;
import org.traccar.model.Event;
@@ -36,7 +34,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$GPRMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.?\\d*," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
@@ -83,7 +81,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder {
Integer end = ChannelBufferTools.find(buf, buf.readerIndex(), buf.readerIndex() + 80, "*");
String gprmc = buf.toString(
buf.readerIndex(), end - buf.readerIndex(), Charset.defaultCharset());
- Matcher parser = pattern.matcher(gprmc);
+ Matcher parser = PATTERN.matcher(gprmc);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/SanavProtocolDecoder.java b/src/org/traccar/protocol/SanavProtocolDecoder.java
index 24f55a165..77af9b214 100644
--- a/src/org/traccar/protocol/SanavProtocolDecoder.java
+++ b/src/org/traccar/protocol/SanavProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Position;
@@ -32,7 +30,7 @@ public class SanavProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
".*imei[:=]" +
"(\\d+)" + // IMEI
"&?rmc[:=]\\$GPRMC," +
@@ -54,7 +52,7 @@ public class SanavProtocolDecoder extends BaseProtocolDecoder {
// Parse message
String sentence = (String) msg;
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
index 72952121a..f27f36ab7 100644
--- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
@@ -31,10 +31,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- //$1,357804047969310,D001,AP29AW0963,01/01/13,13:24:47,1723.9582N,07834.0945E
- //,00100,010,0,0,0,0,
- //0,0008478660,1450,40,34,0,0,0,A
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
".*\\$1," +
"(\\d+)," + // IMEI
"D001," + // Type
@@ -75,7 +72,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index 5ef44fa31..19eed1197 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -32,7 +32,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"S.\\d{3}(?:\\w{3})?;" + // Header
"(?:([^;]+);)?" + // Type
"(\\d{6,});" + // Device ID
@@ -57,7 +57,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java
index 989d24820..ec3919ebe 100644
--- a/src/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/org/traccar/protocol/T55ProtocolDecoder.java
@@ -31,7 +31,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern patternGPRMC = Pattern.compile(
+ private static final Pattern PATTERN_GPRMC = Pattern.compile(
"\\$GPRMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.?\\d*," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
@@ -44,7 +44,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
"(\\d{2})(\\d{2})(\\d{2})" + // Date (DDMMYY)
".+");
- private static final Pattern patternGPGGA = Pattern.compile(
+ private static final Pattern PATTERN_GPGGA = Pattern.compile(
"\\$GPGGA," +
"(\\d{2})(\\d{2})(\\d{2})\\.?\\d*," + // Time
"(\\d+)(\\d{2}\\.\\d+)," + // Latitude
@@ -53,7 +53,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
"([EW])," +
".+");
- private static final Pattern patternGPRMA = Pattern.compile(
+ private static final Pattern PATTERN_GPRMA = Pattern.compile(
"\\$GPRMA," +
"([AV])," + // Validity
"(\\d{2})(\\d{2}\\.\\d+)," + // Latitude
@@ -64,7 +64,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
"(\\d+\\.?\\d*)?," + // Course
".+");
- private static final Pattern patternTRCCR = Pattern.compile(
+ private static final Pattern PATTERN_TRCCR = Pattern.compile(
"\\$TRCCR," +
"(\\d{4})(\\d{2})(\\d{2})" + // Date (YYYYMMDD)
"(\\d{2})(\\d{2})(\\d{2})\\.?\\d*," + // Time (HHMMSS.SSS)
@@ -128,7 +128,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
}
// Parse message
- Matcher parser = patternGPRMC.matcher(sentence);
+ Matcher parser = PATTERN_GPRMC.matcher(sentence);
if (!parser.matches()) {
return null;
}
@@ -186,7 +186,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
else if (sentence.startsWith("$GPGGA") && hasDeviceId()) {
// Parse message
- Matcher parser = patternGPGGA.matcher(sentence);
+ Matcher parser = PATTERN_GPGGA.matcher(sentence);
if (!parser.matches()) {
return null;
}
@@ -227,7 +227,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
else if (sentence.startsWith("$GPRMA") && hasDeviceId()) {
// Parse message
- Matcher parser = patternGPRMA.matcher(sentence);
+ Matcher parser = PATTERN_GPRMA.matcher(sentence);
if (!parser.matches()) {
return null;
}
@@ -275,7 +275,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
else if (sentence.startsWith("$TRCCR") && hasDeviceId()) {
// Parse message
- Matcher parser = patternTRCCR.matcher(sentence);
+ Matcher parser = PATTERN_TRCCR.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/TaipProtocolDecoder.java b/src/org/traccar/protocol/TaipProtocolDecoder.java
index 7545df13e..860dd4602 100644
--- a/src/org/traccar/protocol/TaipProtocolDecoder.java
+++ b/src/org/traccar/protocol/TaipProtocolDecoder.java
@@ -21,9 +21,7 @@ import java.util.Date;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
@@ -37,7 +35,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
this.sendResponse = sendResponse;
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(?:R[EP]V" + // Type
"(?:\\d{2}" + // Event index
"(\\d{4})" + // Week
@@ -123,7 +121,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
}
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/TelikProtocolDecoder.java b/src/org/traccar/protocol/TelikProtocolDecoder.java
index 28df23999..255a3032b 100644
--- a/src/org/traccar/protocol/TelikProtocolDecoder.java
+++ b/src/org/traccar/protocol/TelikProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -33,7 +31,7 @@ public class TelikProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\d{4}" +
"(\\d{6})" + // Device ID
"(\\d+)," + // Type
@@ -55,7 +53,7 @@ public class TelikProtocolDecoder extends BaseProtocolDecoder {
throws Exception {
// Parse message
- Matcher parser = pattern.matcher((String) msg);
+ Matcher parser = PATTERN.matcher((String) msg);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Tk102ProtocolDecoder.java b/src/org/traccar/protocol/Tk102ProtocolDecoder.java
index 78f436a2f..f9db1a9e7 100644
--- a/src/org/traccar/protocol/Tk102ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk102ProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Position;
@@ -32,7 +30,7 @@ public class Tk102ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\[.\\d{10}.\\(\\p{Upper}+" +
"(\\d{2})(\\d{2})(\\d{2})" + // Time (HHMMSS)
"([AV])" + // Validity
@@ -71,7 +69,7 @@ public class Tk102ProtocolDecoder extends BaseProtocolDecoder {
else if (hasDeviceId()) {
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index f2a561050..56d975e46 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -34,7 +34,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(\\d+)(,)?" + // Device ID
".{4},?" + // Command
"\\d*" + // IMEI (?)
@@ -76,7 +76,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
}
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index 56d8f59ba..9cbbf570a 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -22,9 +22,7 @@ import java.util.List;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -35,14 +33,14 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern patternHeader = Pattern.compile(
+ private static final Pattern PATTERN_HEADER = Pattern.compile(
"#(\\d+)#" + // IMEI
"[^#]+#" +
"\\d+#" +
"([^#]+)#" + // Status
"\\d+"); // Number of records
- private static final Pattern patternPosition = Pattern.compile(
+ private static final Pattern PATTERN_POSITION = Pattern.compile(
"#([0-9a-f]+)?" + // Cell info
"\\$GPRMC," +
"(\\d{2})(\\d{2})(\\d{2})\\.(\\d+)," + // Time (HHMMSS.SSS)
@@ -66,7 +64,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
// Decode header
String header = sentence.substring(0, sentence.indexOf('\r'));
- Matcher parser = patternHeader.matcher(header);
+ Matcher parser = PATTERN_HEADER.matcher(header);
if (!parser.matches()) {
return null;
}
@@ -83,7 +81,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
List<Position> positions = new LinkedList<>();
for (String message : messages) {
- parser = patternPosition.matcher(message);
+ parser = PATTERN_POSITION.matcher(message);
if (parser.matches()) {
Position position = new Position();
position.setProtocol(getProtocolName());
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index 960cd9963..087416f18 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -32,7 +32,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern1 = new PatternBuilder()
+ private static final Pattern PATTERN1 = new PatternBuilder()
.txt("$$") // header
.num("xx") // length
.num("(d+)|") // imei
@@ -65,7 +65,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
.any()
.compile();
- private static final Pattern pattern2 = Pattern.compile(
+ private static final Pattern PATTERN2 = Pattern.compile(
"\\$\\$" + // Header
"\\p{XDigit}{2}" + // Length
"(\\d+)\\|" + // IMEI
@@ -92,7 +92,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
"\\p{XDigit}{4}" + // Checksum
"\r?\n?");
- private static final Pattern pattern3 = Pattern.compile(
+ private static final Pattern PATTERN3 = Pattern.compile(
"\\$\\$" + // Header
"\\p{XDigit}{2}" + // Length
"(\\d+)\\|" + // IMEI
@@ -130,13 +130,13 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Determine format
- Pattern pattern = pattern3;
+ Pattern pattern = PATTERN3;
if (sentence.contains("$GPRMC")) {
- pattern = pattern1;
+ pattern = PATTERN1;
} else {
int index = sentence.indexOf('|');
if (index != -1 && sentence.indexOf('|', index + 1) != -1) {
- pattern = pattern2;
+ pattern = PATTERN2;
}
}
@@ -161,13 +161,13 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
// Alarm type
position.set(Event.KEY_ALARM, parser.group(index++));
- if (pattern == pattern1 || pattern == pattern2) {
+ if (pattern == PATTERN1 || pattern == PATTERN2) {
// Time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
int year = 0;
- if (pattern == pattern2) {
+ if (pattern == PATTERN2) {
time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++)));
time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1);
year = Integer.parseInt(parser.group(index++));
@@ -205,7 +205,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
}
// Date
- if (pattern == pattern1) {
+ if (pattern == PATTERN1) {
time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++)));
time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1);
year = Integer.parseInt(parser.group(index++));
@@ -238,7 +238,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
// Odometer
position.set(Event.KEY_ODOMETER, parser.group(index++));
- } else if (pattern == pattern3) {
+ } else if (pattern == PATTERN3) {
// Time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
diff --git a/src/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
index d097ee3fe..069757820 100644
--- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
@@ -33,10 +31,10 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern patternPing = Pattern.compile(
+ private static final Pattern PATTERN_PING = Pattern.compile(
"%%[^,]+,(\\d+)");
- private static final Pattern patternData = Pattern.compile(
+ private static final Pattern PATTERN_DATA = Pattern.compile(
"%%" +
"([^,]+)," + // Id
"([AL])," + // Validity
@@ -58,7 +56,7 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Keep alive message
- Matcher parser = patternPing.matcher(sentence);
+ Matcher parser = PATTERN_PING.matcher(sentence);
if (parser.matches()) {
// Send response
@@ -68,7 +66,7 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder {
} else {
// Data message parse
- parser = patternData.matcher(sentence);
+ parser = PATTERN_DATA.matcher(sentence);
// Unknown message
if (!parser.matches()) {
diff --git a/src/org/traccar/protocol/Tr900ProtocolDecoder.java b/src/org/traccar/protocol/Tr900ProtocolDecoder.java
index 96f76a420..f8d0a7a5c 100644
--- a/src/org/traccar/protocol/Tr900ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tr900ProtocolDecoder.java
@@ -31,7 +31,7 @@ public class Tr900ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
">(\\d+)," + // ID
"\\d+," + // Period
"(\\d)," + // Fix
@@ -61,7 +61,7 @@ public class Tr900ProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/TrackboxProtocolDecoder.java b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
index 7db437a6e..30b327df6 100644
--- a/src/org/traccar/protocol/TrackboxProtocolDecoder.java
+++ b/src/org/traccar/protocol/TrackboxProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -33,7 +31,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(\\d{2})(\\d{2})(\\d{2})\\.(\\d{3})," + // Time
"(\\d{2})(\\d{2}\\.\\d{4})([NS])," + // Latitude (DDMM.MMMM)
"(\\d{3})(\\d{2}\\.\\d{4})([EW])," + // Longitude (DDDMM.MMMM)
@@ -68,7 +66,7 @@ public class TrackboxProtocolDecoder extends BaseProtocolDecoder {
else {
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index abe599754..7628bed88 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -33,7 +31,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(?:#(\\d+)#" + // IMEI
"([^#]*)#)?" + // User
"(\\d+)#" + // Fix
@@ -67,7 +65,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
} else {
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/VisiontekProtocolDecoder.java b/src/org/traccar/protocol/VisiontekProtocolDecoder.java
index a1a5cf6c9..f974d08be 100644
--- a/src/org/traccar/protocol/VisiontekProtocolDecoder.java
+++ b/src/org/traccar/protocol/VisiontekProtocolDecoder.java
@@ -32,7 +32,7 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$1," +
"([^,]+)," + // Identifier
"(?:(\\d+),)?" + // IMEI
@@ -63,7 +63,7 @@ public class VisiontekProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java
index fea00a536..5df26229a 100644
--- a/src/org/traccar/protocol/WialonProtocolDecoder.java
+++ b/src/org/traccar/protocol/WialonProtocolDecoder.java
@@ -22,9 +22,7 @@ import java.util.List;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
@@ -36,7 +34,7 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(\\d{2})(\\d{2})(\\d{2});" + // Date (DDMMYY)
"(\\d{2})(\\d{2})(\\d{2});" + // Time (HHMMSS)
"(\\d{2})(\\d{2}\\.\\d+);" + // Latitude (DDMM.MMMM)
@@ -70,7 +68,7 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder {
private Position decodePosition(String substring) {
// Parse message
- Matcher parser = pattern.matcher(substring);
+ Matcher parser = PATTERN.matcher(substring);
if (!hasDeviceId() || !parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/WondexProtocolDecoder.java b/src/org/traccar/protocol/WondexProtocolDecoder.java
index dbd15c3d0..c2a5a2201 100644
--- a/src/org/traccar/protocol/WondexProtocolDecoder.java
+++ b/src/org/traccar/protocol/WondexProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
@@ -34,7 +32,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"[^\\d]*" + // Header
"(\\d+)," + // Device Identifier
"(\\d{4})(\\d{2})(\\d{2})" + // Date (YYYYMMDD)
@@ -59,7 +57,7 @@ public class WondexProtocolDecoder extends BaseProtocolDecoder {
throws Exception {
// Parse message
- Matcher parser = pattern.matcher((String) msg);
+ Matcher parser = PATTERN.matcher((String) msg);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index 1a32dbacd..32d8eb427 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.PatternBuilder;
import org.traccar.model.Event;
@@ -37,7 +35,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
this.full = full;
}
- private static final Pattern patternBasic = new PatternBuilder()
+ private static final Pattern PATTERN_BASIC = new PatternBuilder()
.xpr("G[PN]RMC,")
.num("(dd)(dd)(dd).(d+),") // time
.xpr("([AV]),") // validity
@@ -54,11 +52,11 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
.num("imei:(d+),") // imei
.compile();
- private static final Pattern patternFull = new PatternBuilder()
+ private static final Pattern PATTERN_FULL = new PatternBuilder()
.any()
.num("(d+),") // serial
.xpr("([^,]+)?,") // phone number
- .xpr(patternBasic.pattern())
+ .xpr(PATTERN_BASIC.pattern())
.num("(d+),") // satellites
.num("(-?d+.d+)?,") // altitude
.num("[FL]:(d+.d+)V") // power
@@ -68,7 +66,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
@Override
protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
- Pattern pattern = full ? patternFull : patternBasic;
+ Pattern pattern = full ? PATTERN_FULL : PATTERN_BASIC;
Matcher parser = pattern.matcher((String) msg);
if (!parser.matches()) {
return null;
diff --git a/src/org/traccar/protocol/XirgoProtocolDecoder.java b/src/org/traccar/protocol/XirgoProtocolDecoder.java
index f58136a21..400d3c76c 100644
--- a/src/org/traccar/protocol/XirgoProtocolDecoder.java
+++ b/src/org/traccar/protocol/XirgoProtocolDecoder.java
@@ -32,7 +32,7 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"\\$\\$" +
"(\\d+)," + // IMEI
"(\\d+)," + // Event
@@ -59,7 +59,7 @@ public class XirgoProtocolDecoder extends BaseProtocolDecoder {
String sentence = (String) msg;
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}
diff --git a/src/org/traccar/protocol/Xt013ProtocolDecoder.java b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
index a61e8b82b..3c3c06b3d 100644
--- a/src/org/traccar/protocol/Xt013ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
@@ -15,18 +15,17 @@
*/
package org.traccar.protocol;
-import org.jboss.netty.channel.Channel;
-import org.traccar.BaseProtocolDecoder;
-import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
-import org.traccar.model.Position;
-
-import java.text.ParseException;
import java.net.SocketAddress;
+import java.text.ParseException;
import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.jboss.netty.channel.Channel;
+import org.traccar.BaseProtocolDecoder;
+import org.traccar.helper.UnitsConverter;
+import org.traccar.model.Event;
+import org.traccar.model.Position;
public class Xt013ProtocolDecoder extends BaseProtocolDecoder {
@@ -34,7 +33,7 @@ public class Xt013ProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"(?:HI,\\d+)?" +
"TK," +
"(\\d+)," + // IMEI
@@ -64,7 +63,7 @@ public class Xt013ProtocolDecoder extends BaseProtocolDecoder {
// Parse message
String sentence = (String) msg;
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
throw new ParseException(null, 0);
}
diff --git a/src/org/traccar/protocol/YwtProtocolDecoder.java b/src/org/traccar/protocol/YwtProtocolDecoder.java
index 9b3d2eb86..be76d1d86 100644
--- a/src/org/traccar/protocol/YwtProtocolDecoder.java
+++ b/src/org/traccar/protocol/YwtProtocolDecoder.java
@@ -20,9 +20,7 @@ import java.util.Calendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.jboss.netty.channel.Channel;
-
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -33,7 +31,7 @@ public class YwtProtocolDecoder extends BaseProtocolDecoder {
super(protocol);
}
- private static final Pattern pattern = Pattern.compile(
+ private static final Pattern PATTERN = Pattern.compile(
"%(..)," + // Type
"(\\d+):" + // Unit identifier
"\\d+," + // Subtype
@@ -74,7 +72,7 @@ public class YwtProtocolDecoder extends BaseProtocolDecoder {
}
// Parse message
- Matcher parser = pattern.matcher(sentence);
+ Matcher parser = PATTERN.matcher(sentence);
if (!parser.matches()) {
return null;
}