From df0057d262571182d721d0b79cb5d64b90f834d6 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 7 Nov 2014 12:50:31 -0800 Subject: 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 --- uemis.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'uemis.c') 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; } -- cgit v1.2.3-70-g09d2