From 6085a11b1f4e2322bfb4826eaf7bea482c572f41 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 6 Jun 2018 08:44:32 +0200 Subject: [PATCH] Add the average depth to the xml output --- examples/output_xml.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/examples/output_xml.c b/examples/output_xml.c index b66fc27..9a5a9a8 100644 --- a/examples/output_xml.c +++ b/examples/output_xml.c @@ -265,6 +265,20 @@ dctool_xml_output_write (dctool_output_t *abstract, dc_parser_t *parser, const u fprintf (output->ostream, "%.2f\n", convert_depth(maxdepth, output->units)); + // Parse the avgdepth. + message ("Parsing the avgdepth.\n"); + double avgdepth = 0.0; + status = dc_parser_get_field (parser, DC_FIELD_AVGDEPTH, 0, &avgdepth); + if (status != DC_STATUS_SUCCESS && status != DC_STATUS_UNSUPPORTED) { + ERROR ("Error parsing the avgdepth."); + goto cleanup; + } + + if (status != DC_STATUS_UNSUPPORTED) { + fprintf (output->ostream, "%.2f\n", + convert_depth(avgdepth, output->units)); + } + // Parse the temperature. message ("Parsing the temperature.\n"); for (unsigned int i = 0; i < 3; ++i) {