summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-01 13:02:30 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-04 21:05:26 -0800
commitdcb6574dc4252c4ff598efb17269b7f1255afec1 (patch)
treec774cd0bb3c85c36988976ce1ab6086c9e996f7b /parse-xml.c
parent7383f7fe0a77c906aafcd61ccfc09dc1866c5416 (diff)
downloadsubsurface-dcb6574dc4252c4ff598efb17269b7f1255afec1.tar.gz
Improve deco handling and add NDL support
This commit changes the code that was recently introduced to deal with deco ceilings. Instead of handling these through events we now store the ceiling (which in reality is the deepest deco stop with all known dive computers) and the stop time at that ceiling in the samples. This also adds support for NDL (non stop dive limit) which both dive computers that appear to give us ceiling / deco information appear to give us as well (when the diver isn't in deco). If the mouse hovers over the profile we now add support for displaying the NDL, the current deco obligation and (if we are able to tell from the data) whether we are at a safety stop. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 9226aa63d..2470f8bb4 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -168,6 +168,7 @@ static struct {
} cur_event;
static struct tm cur_tm;
static int cur_cylinder_index, cur_ws_index;
+static int lastndl, laststoptime, laststopdepth;
static enum import_source {
UNKNOWN,
@@ -668,6 +669,12 @@ static void try_to_fill_sample(struct sample *sample, const char *name, char *bu
return;
if (MATCH(".sample.time", sampletime, &sample->time))
return;
+ if (MATCH(".sample.ndl", sampletime, &sample->ndl))
+ return;
+ if (MATCH(".sample.stoptime", sampletime, &sample->stoptime))
+ return;
+ if (MATCH(".sample.stopdepth", depth, &sample->stopdepth))
+ return;
switch (import_source) {
case DIVINGLOG:
@@ -1027,6 +1034,9 @@ static void ws_end(void)
static void sample_start(void)
{
cur_sample = prepare_sample(get_dc());
+ cur_sample->ndl.seconds = lastndl;
+ cur_sample->stoptime.seconds = laststoptime;
+ cur_sample->stopdepth.mm = laststopdepth;
}
static void sample_end(void)
@@ -1035,6 +1045,9 @@ static void sample_end(void)
return;
finish_sample(get_dc());
+ lastndl = cur_sample->ndl.seconds;
+ laststoptime = cur_sample->stoptime.seconds;
+ laststopdepth = cur_sample->stopdepth.mm;
cur_sample = NULL;
}
@@ -1058,6 +1071,8 @@ static void divecomputer_start(void)
/* .. this is the one we'll use */
cur_dc = dc;
+
+ lastndl = laststoptime = laststopdepth = 0;
}
static void divecomputer_end(void)