diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-01-23 11:53:42 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-23 11:53:42 -0800 |
commit | c521aec88452460cc139d9d74d1f23ef58eac1a6 (patch) | |
tree | 819396ee40b8ca251f854560c22b1f10c67b855c /parse-xml.c | |
parent | b1db60ba4795638192c0dea93670d858d4178528 (diff) | |
download | subsurface-c521aec88452460cc139d9d74d1f23ef58eac1a6.tar.gz |
Import and merge GPS data from the webservice
Dive locations marked (and named) via the companion app are downloaded
from the webservice, parsed and merged with the existing dives.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r-- | parse-xml.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/parse-xml.c b/parse-xml.c index 35ebf0446..6aa063467 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -909,6 +909,22 @@ static degrees_t parse_degrees(char *buf, char **end) return ret; } +static void gps_lat(char *buffer, void *_dive) +{ + char *end; + struct dive *dive = _dive; + + dive->latitude = parse_degrees(buffer, &end); +} + +static void gps_long(char *buffer, void *_dive) +{ + char *end; + struct dive *dive = _dive; + + dive->longitude = parse_degrees(buffer, &end); +} + static void gps_location(char *buffer, void *_dive) { char *end; @@ -984,8 +1000,14 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf) return; if (MATCH(".gps", gps_location, dive)) return; + if (MATCH(".latitude", gps_lat, dive)) + return; + if (MATCH(".longitude", gps_long, dive)) + return; if (MATCH(".location", utf8_string, &dive->location)) return; + if (MATCH(".name", utf8_string, &dive->location)) + return; if (MATCH(".suit", utf8_string, &dive->suit)) return; if (MATCH(".divesuit", utf8_string, &dive->suit)) |