aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-19 14:03:56 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-19 14:03:56 +1200
commit4aa2838cd7a71ee1d0c819ce6a37bd2aaddd233d (patch)
tree5eb11de2b2344cd5fb7f7e70079d8567677940d3
parent278712a8720e1e93e63063d7854a1767dd06c3f2 (diff)
downloadtrackermap-server-4aa2838cd7a71ee1d0c819ce6a37bd2aaddd233d.tar.gz
trackermap-server-4aa2838cd7a71ee1d0c819ce6a37bd2aaddd233d.tar.bz2
trackermap-server-4aa2838cd7a71ee1d0c819ce6a37bd2aaddd233d.zip
Fix Haicom hemisphere decoding
-rw-r--r--src/org/traccar/protocol/HaicomProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/HaicomProtocolDecoderTest.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/HaicomProtocolDecoder.java b/src/org/traccar/protocol/HaicomProtocolDecoder.java
index fc144e934..5955ac905 100644
--- a/src/org/traccar/protocol/HaicomProtocolDecoder.java
+++ b/src/org/traccar/protocol/HaicomProtocolDecoder.java
@@ -98,13 +98,13 @@ public class HaicomProtocolDecoder extends BaseProtocolDecoder {
// Latitude
Double latitude = Double.valueOf(parser.group(index++));
latitude += Double.valueOf(parser.group(index++)) / 60000;
- if ((flags & 0x2) == 0) latitude = -latitude;
+ if ((flags & 0x4) == 0) latitude = -latitude;
position.setLatitude(latitude);
// Longitude
Double longitude = Double.valueOf(parser.group(index++));
longitude += Double.valueOf(parser.group(index++)) / 60000;
- if ((flags & 0x4) == 0) longitude = -longitude;
+ if ((flags & 0x2) == 0) longitude = -longitude;
position.setLongitude(longitude);
// Speed
diff --git a/test/org/traccar/protocol/HaicomProtocolDecoderTest.java b/test/org/traccar/protocol/HaicomProtocolDecoderTest.java
index 13659d040..4ccd0fbd4 100644
--- a/test/org/traccar/protocol/HaicomProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/HaicomProtocolDecoderTest.java
@@ -12,6 +12,9 @@ public class HaicomProtocolDecoderTest extends ProtocolDecoderTest {
HaicomProtocolDecoder decoder = new HaicomProtocolDecoder(null);
verify(decoder.decode(null, null,
+ "$GPRS012497007097169,T100001,150618,230031,5402267400332464,0004,2014,000001,,,1,00#V040*"));
+
+ verify(decoder.decode(null, null,
"$GPRS123456789012345,602S19A,100915,063515,7240649312041079,0019,3156,111000,10004,0000,11111,00LH#V037"));
verify(decoder.decode(null, null,