aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/EnforaProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/EnforaProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/EnforaProtocolDecoder.java30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/org/traccar/protocol/EnforaProtocolDecoder.java b/src/org/traccar/protocol/EnforaProtocolDecoder.java
index 110aa050d..3e341ea8b 100644
--- a/src/org/traccar/protocol/EnforaProtocolDecoder.java
+++ b/src/org/traccar/protocol/EnforaProtocolDecoder.java
@@ -15,15 +15,13 @@
*/
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;
@@ -106,39 +104,39 @@ public class EnforaProtocolDecoder extends BaseProtocolDecoder {
// Time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
time.clear();
- time.set(Calendar.HOUR_OF_DAY, Integer.valueOf(parser.group(index++)));
- time.set(Calendar.MINUTE, Integer.valueOf(parser.group(index++)));
- time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++)));
- time.set(Calendar.MILLISECOND, Integer.valueOf(parser.group(index++)) * 10);
+ time.set(Calendar.HOUR_OF_DAY, Integer.parseInt(parser.group(index++)));
+ time.set(Calendar.MINUTE, Integer.parseInt(parser.group(index++)));
+ time.set(Calendar.SECOND, Integer.parseInt(parser.group(index++)));
+ time.set(Calendar.MILLISECOND, Integer.parseInt(parser.group(index++)) * 10);
// Validity
position.setValid(parser.group(index++).compareTo("A") == 0);
// Latitude
- Double latitude = Double.valueOf(parser.group(index++));
- latitude += Double.valueOf(parser.group(index++)) / 60;
+ double latitude = Double.parseDouble(parser.group(index++));
+ latitude += Double.parseDouble(parser.group(index++)) / 60;
if (parser.group(index++).compareTo("S") == 0) latitude = -latitude;
position.setLatitude(latitude);
// Longitude
- Double longitude = Double.valueOf(parser.group(index++));
- longitude += Double.valueOf(parser.group(index++)) / 60;
+ double longitude = Double.parseDouble(parser.group(index++));
+ longitude += Double.parseDouble(parser.group(index++)) / 60;
if (parser.group(index++).compareTo("W") == 0) longitude = -longitude;
position.setLongitude(longitude);
// Speed
- position.setSpeed(Double.valueOf(parser.group(index++)));
+ position.setSpeed(Double.parseDouble(parser.group(index++)));
// Course
String course = parser.group(index++);
if (course != null) {
- position.setCourse(Double.valueOf(course));
+ position.setCourse(Double.parseDouble(course));
}
// Date
- time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++)));
- time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1);
- time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++)));
+ time.set(Calendar.DAY_OF_MONTH, Integer.parseInt(parser.group(index++)));
+ time.set(Calendar.MONTH, Integer.parseInt(parser.group(index++)) - 1);
+ time.set(Calendar.YEAR, 2000 + Integer.parseInt(parser.group(index++)));
position.setTime(time.getTime());
return position;
}