diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-11-05 23:55:46 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-11-05 23:55:46 +1300 |
commit | 34b1bd88ab1f5e75156567ba75d7d3a06f39048c (patch) | |
tree | ae7e39a0a31609cc468a53ece2db2cdad7edf4b3 /src | |
parent | 8b4dc809a91bcd124ae087988aa79ceaeff1fd36 (diff) | |
download | traccar-server-34b1bd88ab1f5e75156567ba75d7d3a06f39048c.tar.gz traccar-server-34b1bd88ab1f5e75156567ba75d7d3a06f39048c.tar.bz2 traccar-server-34b1bd88ab1f5e75156567ba75d7d3a06f39048c.zip |
Wierd gps103 message (fix #78)
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index cc0fcb9cb..a8d819cbc 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -40,6 +40,7 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder { /** * Regular expressions pattern */ + //imei:863070010423167,tracker,1211051840,,F,104000.000,A,2220.6483,N,11407.6377,,0,0, static private Pattern pattern = Pattern.compile( "imei:" + "([\\d]+)," + // IMEI @@ -52,7 +53,7 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder { "([\\d]{2})([\\d]{2}.[\\d]{4})," + // Latitude (DDMM.MMMM) "([NS])," + "([\\d]{3})([\\d]{2}.[\\d]{4})," + // Longitude (DDDMM.MMMM) - "([EW])," + + "([EW])?," + "([\\d]+.[\\d]{2})," + // Speed ".*"); @@ -124,7 +125,10 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder { // Longitude Double lonlitude = Double.valueOf(parser.group(index++)); lonlitude += Double.valueOf(parser.group(index++)) / 60; - if (parser.group(index++).compareTo("W") == 0) lonlitude = -lonlitude; + String hemisphere = parser.group(index++); + if (hemisphere != null) { + if (hemisphere.compareTo("W") == 0) lonlitude = -lonlitude; + } position.setLongitude(lonlitude); // Altitude |