From da76f9195ec6fbf0e6a0a6419eec908b91f844b7 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 17 Oct 2015 13:09:05 +1300 Subject: Refactor GPS103 protocol decoder --- src/org/traccar/helper/Parser.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/org/traccar/helper/Parser.java') diff --git a/src/org/traccar/helper/Parser.java b/src/org/traccar/helper/Parser.java index 107ae7bff..7694a9623 100644 --- a/src/org/traccar/helper/Parser.java +++ b/src/org/traccar/helper/Parser.java @@ -80,7 +80,8 @@ public class Parser { public enum CoordinateFormat { DEG_MIN_HEM, - HEM_DEG + HEM_DEG, + HEM_DEG_MIN_HEM } public double nextCoordinate(CoordinateFormat format) { @@ -92,9 +93,16 @@ public class Parser { hemisphere = next(); coordinate = nextDouble(); break; - case DEG_MIN_HEM: + case HEM_DEG_MIN_HEM: + hemisphere = next(); + coordinate = nextInt(); + coordinate += nextDouble() / 60; + if (hasNext()) { + hemisphere = next(); + } + break; default: - coordinate = nextDouble(); + coordinate = nextInt(); coordinate += nextDouble() / 60; hemisphere = next(); break; -- cgit v1.2.3