[PATCH] Added support for parsing temperature in the dive header

Jef Driesen jef at libdivecomputer.org
Wed Sep 3 22:21:19 PDT 2014


On 25-08-14 00:02, Jef Driesen wrote:
> For the api, maybe we can stick to the DC_FIELD_TEMPERATURE with a single double
> value, but use the flag parameter of the dc_parser_get_field function to specify
> the subtype:
>
> typedef enum dc_temperature_t {
>      DC_TEMPERATURE_SURFACE,
>      DC_TEMPERATURE_MINIMUM,
>      DC_TEMPERATURE_MAXIMUM,
> } dc_temperature_t;
>
> In the application you would call like this:
>
> dc_parser_get_field (parser, DC_FIELD_TEMPERATURE, DC_TEMPERATURE_XXX, &value);
>
> What do you think?

Answering my own question, I think it will be easier (to implement on my side) 
to just define three temperature fields:

DC_FIELD_TEMPERATURE_SURFACE
DC_FIELD_TEMPERATURE_MINIMUM
DC_FIELD_TEMPERATURE_MAXIMUM

instead of subtypes. On the application side this shouldn't make any difference.

Jef


More information about the devel mailing list