diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-08-20 20:22:49 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-08-20 20:22:49 +1200 |
commit | 4aa19cf3ab240abb7dc9c16240d993f5b525edaa (patch) | |
tree | dcc7c71974c4397100cce9e1760fb5cbf0348c45 | |
parent | 51b475ce8920f0340560749f779f1acfd3914911 (diff) | |
download | traccar-server-4aa19cf3ab240abb7dc9c16240d993f5b525edaa.tar.gz traccar-server-4aa19cf3ab240abb7dc9c16240d993f5b525edaa.tar.bz2 traccar-server-4aa19cf3ab240abb7dc9c16240d993f5b525edaa.zip |
Fix GlobalSat decoder
-rw-r--r-- | src/org/traccar/protocol/GlobalSatProtocolDecoder.java | 4 | ||||
-rw-r--r-- | test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java index 974fe7699..3d3ecd02e 100644 --- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java +++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java @@ -121,13 +121,13 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { break; case '1': double longitude = Double.valueOf(value.substring(1)); - if (value.charAt(0) == 'E') longitude = -longitude; + if (value.charAt(0) == 'W') longitude = -longitude; position.setLongitude(longitude); break; case '2': longitude = Double.valueOf(value.substring(4)) / 60; longitude += Integer.valueOf(value.substring(1, 4)); - if (value.charAt(0) == 'E') longitude = -longitude; + if (value.charAt(0) == 'W') longitude = -longitude; position.setLongitude(longitude); break; case '3': diff --git a/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java b/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java index 664021ef7..35822fb91 100644 --- a/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GlobalSatProtocolDecoderTest.java @@ -19,6 +19,9 @@ public class GlobalSatProtocolDecoderTest { "GSr,1,135785412249986,01,I,EA02,3,230410,153318,E12129.2839,N2459.8570,0,1.17,212,8,1.0,12.3V*55")); assertNotNull(decoder.decode(null, null, + "GSr,GTR-128,012896009148443,0040,5,0080,3,190813,185812,W11203.3661,N3330.2104,344,0.24,78,9,0.8,60%,0,0,12,\"310,410,0bdd,050d,02,21\",\"310,410,0bdd,0639,24,7\"*79")); + + assertNotNull(decoder.decode(null, null, "$355632004245866,1,1,040202,093633,E12129.2252,N2459.8891,00161,0.0100,147,07,2.4")); assertNotNull(decoder.decode(null, null, |