aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/Avl08ProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/EnforaProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/Gl100ProtocolDecoder.java15
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java13
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java11
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/T55ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java5
-rw-r--r--src/org/traccar/protocol/Xexun2ProtocolDecoder.java3
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java7
10 files changed, 34 insertions, 44 deletions
diff --git a/src/org/traccar/protocol/Avl08ProtocolDecoder.java b/src/org/traccar/protocol/Avl08ProtocolDecoder.java
index 13ee776cb..0ca976d26 100644
--- a/src/org/traccar/protocol/Avl08ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl08ProtocolDecoder.java
@@ -16,14 +16,13 @@
package org.traccar.protocol;
import java.util.Calendar;
-import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
-import org.traccar.model.DataManager;
import org.traccar.GenericProtocolDecoder;
+import org.traccar.model.DataManager;
import org.traccar.model.Position;
/**
@@ -37,7 +36,7 @@ public class Avl08ProtocolDecoder extends GenericProtocolDecoder {
public Avl08ProtocolDecoder(DataManager dataManager, Integer resetDelay) {
super(dataManager, resetDelay);
}
-
+
/**
* Regular expressions pattern
*/
@@ -90,12 +89,12 @@ public class Avl08ProtocolDecoder extends GenericProtocolDecoder {
// Get device by IMEI
String imei = parser.group(index++);
position.setDeviceId(getDataManager().getDeviceByImei(imei).getId());
-
+
// Alarm type
extendedInfo += "<alarm>" + parser.group(index++) + "</alarm>";
-
+
// Time
- Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
time.set(Calendar.HOUR, Integer.valueOf(parser.group(index++)));
time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++)));
@@ -119,7 +118,7 @@ public class Avl08ProtocolDecoder extends GenericProtocolDecoder {
// Altitude
position.setAltitude(0.0);
-
+
// Speed
position.setSpeed(Double.valueOf(parser.group(index++)));
diff --git a/src/org/traccar/protocol/EnforaProtocolDecoder.java b/src/org/traccar/protocol/EnforaProtocolDecoder.java
index eb9cb8ae4..196f16f05 100644
--- a/src/org/traccar/protocol/EnforaProtocolDecoder.java
+++ b/src/org/traccar/protocol/EnforaProtocolDecoder.java
@@ -17,7 +17,6 @@ package org.traccar.protocol;
import java.nio.charset.Charset;
import java.util.Calendar;
-import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -139,7 +138,7 @@ public class EnforaProtocolDecoder extends GenericProtocolDecoder {
position.setDeviceId(getDataManager().getDeviceByImei(imei).getId());
// Time
- Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
time.set(Calendar.HOUR, Integer.valueOf(parser.group(index++)));
time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++)));
diff --git a/src/org/traccar/protocol/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
index c28fc65a0..8ac68f6f4 100644
--- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
@@ -16,14 +16,13 @@
package org.traccar.protocol;
import java.util.Calendar;
-import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
-import org.traccar.model.DataManager;
import org.traccar.GenericProtocolDecoder;
+import org.traccar.model.DataManager;
import org.traccar.model.Position;
/**
@@ -67,7 +66,7 @@ public class Gl100ProtocolDecoder extends GenericProtocolDecoder {
throws Exception {
String sentence = (String) msg;
-
+
// Send response
if (sentence.contains("AT+GTHBD=")) {
String response = "+RESP:GTHBD,GPRS ACTIVE,";
@@ -75,7 +74,7 @@ public class Gl100ProtocolDecoder extends GenericProtocolDecoder {
response += '\0';
channel.write(response);
}
-
+
// Parse message
Matcher parser = pattern.matcher(sentence);
if (!parser.matches()) {
@@ -90,19 +89,19 @@ public class Gl100ProtocolDecoder extends GenericProtocolDecoder {
// Get device by IMEI
String imei = parser.group(index++);
position.setDeviceId(getDataManager().getDeviceByImei(imei).getId());
-
+
// Validity
position.setValid(Integer.valueOf(parser.group(index++)) == 0 ? false : true);
-
+
// Position info
position.setSpeed(Double.valueOf(parser.group(index++)));
position.setCourse(Double.valueOf(parser.group(index++)));
position.setAltitude(Double.valueOf(parser.group(index++)));
position.setLongitude(Double.valueOf(parser.group(index++)));
position.setLatitude(Double.valueOf(parser.group(index++)));
-
+
// Date
- Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
time.set(Calendar.YEAR, Integer.valueOf(parser.group(index++)));
time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1);
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 9b3144fe8..506b55790 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -16,14 +16,13 @@
package org.traccar.protocol;
import java.util.Calendar;
-import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
-import org.traccar.model.DataManager;
import org.traccar.GenericProtocolDecoder;
+import org.traccar.model.DataManager;
import org.traccar.model.Position;
/**
@@ -68,7 +67,7 @@ public class Gl200ProtocolDecoder extends GenericProtocolDecoder {
throws Exception {
String sentence = (String) msg;
-
+
// Parse message
Matcher parser = pattern.matcher(sentence);
if (!parser.matches()) {
@@ -83,19 +82,19 @@ public class Gl200ProtocolDecoder extends GenericProtocolDecoder {
// Get device by IMEI
String imei = parser.group(index++);
position.setDeviceId(getDataManager().getDeviceByImei(imei).getId());
-
+
// Validity
position.setValid(Integer.valueOf(parser.group(index++)) == 0 ? false : true);
-
+
// Position info
position.setSpeed(Double.valueOf(parser.group(index++)));
position.setCourse(Double.valueOf(parser.group(index++)));
position.setAltitude(Double.valueOf(parser.group(index++)));
position.setLongitude(Double.valueOf(parser.group(index++)));
position.setLatitude(Double.valueOf(parser.group(index++)));
-
+
// Date
- Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
time.set(Calendar.YEAR, Integer.valueOf(parser.group(index++)));
time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1);
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 5142abae8..714a80e49 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -16,14 +16,13 @@
package org.traccar.protocol;
import java.util.Calendar;
-import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
-import org.traccar.model.DataManager;
import org.traccar.GenericProtocolDecoder;
+import org.traccar.model.DataManager;
import org.traccar.model.Position;
/**
@@ -70,7 +69,7 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder {
if (sentence.contains("##")) {
channel.write("LOAD");
}
-
+
// Send response #2
if (sentence.length() == 15 && Character.isDigit(sentence.charAt(0))) {
channel.write("ON");
@@ -90,9 +89,9 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder {
// Get device by IMEI
String imei = parser.group(index++);
position.setDeviceId(getDataManager().getDeviceByImei(imei).getId());
-
+
// Date
- Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++)));
time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1);
@@ -119,7 +118,7 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder {
lonlitude += Double.valueOf(parser.group(index++)) / 60;
if (parser.group(index++).compareTo("W") == 0) lonlitude = -lonlitude;
position.setLongitude(lonlitude);
-
+
// Altitude
position.setAltitude(0.0);
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index e836289e4..c3b376c65 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -18,7 +18,6 @@ package org.traccar.protocol;
import java.nio.charset.Charset;
import java.text.ParseException;
import java.util.Calendar;
-import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -145,7 +144,7 @@ public class MeiligaoProtocolDecoder extends GenericProtocolDecoder {
Integer index = 1;
// Time
- Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
time.set(Calendar.HOUR, Integer.valueOf(parser.group(index++)));
time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++)));
diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java
index 98d0079a6..9342433b7 100644
--- a/src/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/org/traccar/protocol/T55ProtocolDecoder.java
@@ -16,14 +16,13 @@
package org.traccar.protocol;
import java.util.Calendar;
-import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
-import org.traccar.model.DataManager;
import org.traccar.GenericProtocolDecoder;
+import org.traccar.model.DataManager;
import org.traccar.model.Position;
/**
@@ -95,7 +94,7 @@ public class T55ProtocolDecoder extends GenericProtocolDecoder {
Integer index = 1;
// Time
- Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
time.set(Calendar.HOUR, Integer.valueOf(parser.group(index++)));
time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++)));
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 8695d96b2..0b3a9ef32 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -16,14 +16,13 @@
package org.traccar.protocol;
import java.util.Calendar;
-import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
-import org.traccar.model.DataManager;
import org.traccar.GenericProtocolDecoder;
+import org.traccar.model.DataManager;
import org.traccar.model.Position;
/**
@@ -84,7 +83,7 @@ public class Tk103ProtocolDecoder extends GenericProtocolDecoder {
position.setDeviceId(getDataManager().getDeviceByImei(imei).getId());
// Date
- Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++)));
time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1);
diff --git a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
index b10721070..2449a60a6 100644
--- a/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xexun2ProtocolDecoder.java
@@ -16,7 +16,6 @@
package org.traccar.protocol;
import java.util.Calendar;
-import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -94,7 +93,7 @@ public class Xexun2ProtocolDecoder extends GenericProtocolDecoder {
extendedInfo += "<number>" + parser.group(index++) + "</number>";
// Time
- Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
time.set(Calendar.HOUR, Integer.valueOf(parser.group(index++)));
time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++)));
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index 34059501b..f6b7bcb44 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -17,14 +17,13 @@ package org.traccar.protocol;
import java.text.ParseException;
import java.util.Calendar;
-import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
-import org.traccar.model.DataManager;
import org.traccar.GenericProtocolDecoder;
+import org.traccar.model.DataManager;
import org.traccar.model.Position;
/**
@@ -76,7 +75,7 @@ public class XexunProtocolDecoder extends GenericProtocolDecoder {
Integer index = 1;
// Time
- Calendar time = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
time.set(Calendar.HOUR, Integer.valueOf(parser.group(index++)));
time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++)));
@@ -100,7 +99,7 @@ public class XexunProtocolDecoder extends GenericProtocolDecoder {
// Altitude
position.setAltitude(0.0);
-
+
// Speed
position.setSpeed(Double.valueOf(parser.group(index++)));