summaryrefslogtreecommitdiffstats
path: root/uemis.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-07 12:50:31 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-07 13:01:58 -0800
commitdf0057d262571182d721d0b79cb5d64b90f834d6 (patch)
tree4c85a39e23985e3e009f351e229edd3fb893e56d /uemis.c
parent45251ec7248a0300506af043b0a5c448051b2072 (diff)
downloadsubsurface-df0057d262571182d721d0b79cb5d64b90f834d6.tar.gz
Extract some useful extra data from Uemis SDA
This is just a proof of concept for this patch series, mainly designed to show how the extra data would be used. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'uemis.c')
-rw-r--r--uemis.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/uemis.c b/uemis.c
index bdffde0d5..de73e1f9b 100644
--- a/uemis.c
+++ b/uemis.c
@@ -293,9 +293,11 @@ void uemis_parse_divelog_binary(char *base64, void *datap)
struct divecomputer *dc = &dive->dc;
int template, gasoffset;
int active = 0;
+ char version[5];
datalen = uemis_convert_base64(base64, &data);
-
+ snprintf(version, sizeof(version), "%1u.%02u", data[18], data[17]);
+ add_extra_data(dc, "software_version", version);
dive->dc.airtemp.mkelvin = C_to_mkelvin((*(uint16_t *)(data + 45)) / 10.0);
dive->dc.surface_pressure.mbar = *(uint16_t *)(data + 43);
if (*(uint8_t *)(data + 19))
@@ -366,5 +368,19 @@ void uemis_parse_divelog_binary(char *base64, void *datap)
}
if (sample)
dive->dc.duration.seconds = sample->time.seconds - 1;
+
+ /* get data from the footer */
+ char buffer[24];
+ snprintf(buffer, sizeof(buffer), "%d",*(uint16_t *)(data + i + 35));
+ add_extra_data(dc, "main battery after dive", buffer);
+ snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION(*(uint16_t *)(data + i + 24), 60));
+ add_extra_data(dc, "no fly time", buffer);
+ snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION(*(uint16_t *)(data + i + 26), 60));
+ add_extra_data(dc, "no dive time", buffer);
+ snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION(*(uint16_t *)(data + i + 28), 60));
+ add_extra_data(dc, "desat time", buffer);
+ snprintf(buffer, sizeof(buffer), "%u",*(uint16_t *)(data + i + 30));
+ add_extra_data(dc, "allowed altitude", buffer);
+
return;
}