aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-09-19 21:16:26 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2014-09-19 21:16:26 +1200
commit3c3596868b8a18a6c207e902a6568c8e850e7696 (patch)
tree91c3e1f19a99e079d3b24a913d7b4188a0ca8301 /src/org
parent5bced58f76ef64bab98c4ef5323860cee1c4bbec (diff)
downloadtrackermap-server-3c3596868b8a18a6c207e902a6568c8e850e7696.tar.gz
trackermap-server-3c3596868b8a18a6c207e902a6568c8e850e7696.tar.bz2
trackermap-server-3c3596868b8a18a6c207e902a6568c8e850e7696.zip
Workaround missing hemisphere (fix #874)
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index a6c298f44..7a0d71e64 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -41,9 +41,9 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
"(\\d+)(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
"([NS])," +
"(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
- "([EW])," +
- "(\\d+\\.\\d+)," + // Speed
- "(\\d+\\.\\d+)?," + // Course
+ "([EW])?," +
+ "(\\d+\\.?\\d*)," + // Speed
+ "(\\d+\\.?\\d*)?," + // Course
"(\\d{2})(\\d{2})(\\d{2})," + // Date (DDMMYY)
".*\r?\n?.*imei:" +
"(\\d+),"); // IMEI
@@ -86,7 +86,10 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
// Longitude
Double longitude = Double.valueOf(parser.group(index++));
longitude += Double.valueOf(parser.group(index++)) / 60;
- if (parser.group(index++).compareTo("W") == 0) longitude = -longitude;
+ String hemisphere = parser.group(index++);
+ if (hemisphere != null) {
+ if (hemisphere.compareTo("W") == 0) longitude = -longitude;
+ }
position.setLongitude(longitude);
// Altitude