Added support for parsing temperature in the dive header

Devices that only reports a single temperature in the header
will now be able to report it as well when they implement this.

Signed-off-by: Calle Gunnarsson <calle.gunnarsson@gmail.com>
This commit is contained in:
Calle Gunnarsson 2014-08-22 12:06:24 +02:00 committed by Jef Driesen
parent 60665ec633
commit cdbc0cd9bd
2 changed files with 17 additions and 1 deletions

View File

@ -361,6 +361,21 @@ doparse (FILE *fp, dc_device_t *device, const unsigned char data[], unsigned int
fprintf (fp, "<divetime>%02u:%02u</divetime>\n",
divetime / 60, divetime % 60);
// Parse the temperature.
message ("Parsing the temperature.\n");
double temperature = 0.0;
rc = dc_parser_get_field (parser, DC_FIELD_TEMPERATURE, 0, &temperature);
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
WARNING ("Error parsing the temperature.");
dc_parser_destroy (parser);
return rc;
}
if (rc != DC_STATUS_UNSUPPORTED) {
fprintf (fp, "<temperature>%.1f</temperature>\n",
temperature);
}
// Parse the maxdepth.
message ("Parsing the maxdepth.\n");
double maxdepth = 0.0;

View File

@ -53,7 +53,8 @@ typedef enum dc_field_type_t {
DC_FIELD_GASMIX_COUNT,
DC_FIELD_GASMIX,
DC_FIELD_SALINITY,
DC_FIELD_ATMOSPHERIC
DC_FIELD_ATMOSPHERIC,
DC_FIELD_TEMPERATURE
} dc_field_type_t;
typedef enum parser_sample_event_t {