From dfa728598edc0fd3ad495198c3b4666fc644d16c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 23 Dec 2015 09:50:33 +1300 Subject: Fix hemisphere decoding for H02 protocol --- src/org/traccar/helper/Parser.java | 2 +- src/org/traccar/protocol/H02ProtocolDecoder.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/helper/Parser.java b/src/org/traccar/helper/Parser.java index 7c5f84f55..a3f118df0 100644 --- a/src/org/traccar/helper/Parser.java +++ b/src/org/traccar/helper/Parser.java @@ -157,7 +157,7 @@ public class Parser { } public double nextCoordinate() { - return nextCoordinate(CoordinateFormat.DEG_MIN_HEM); + return nextCoordinate(CoordinateFormat.DEG_MIN_HEM); } } diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index 2b8adda4a..c4ba6ffa3 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -123,15 +123,15 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { .number("(dd)(dd)(dd),") // time .expression("([AV])?,") // validity .groupBegin() - .number("(d+)(dd.d+),") // latitude - .or() .number("-(d+)-(d+.d+),") // latitude + .or() + .number("(d+)(dd.d+),") // latitude .groupEnd() .expression("([NS]),") .groupBegin() - .number("(d+)(dd.d+),") // longitude - .or() .number("-(d+)-(d+.d+),") // longitude + .or() + .number("(d+)(dd.d+),") // longitude .groupEnd() .expression("([EW]),") .number("(d+.?d*),") // speed @@ -164,14 +164,14 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { } if (parser.hasNext(2)) { - position.setLatitude(parser.nextCoordinate()); + position.setLatitude(-parser.nextCoordinate()); } if (parser.hasNext(2)) { position.setLatitude(parser.nextCoordinate()); } if (parser.hasNext(2)) { - position.setLongitude(parser.nextCoordinate()); + position.setLongitude(-parser.nextCoordinate()); } if (parser.hasNext(2)) { position.setLongitude(parser.nextCoordinate()); -- cgit v1.2.3