[PATCH] Added support for parsing temperature in the dive header
Jef Driesen
jef at libdivecomputer.org
Sun Aug 24 23:52:14 PDT 2014
On 2014-08-25 00:19, Sven Knoch wrote:
> I think this would be a good solution. Is there a way to find out if
> temperature data is not available? Because returning a zero could mean
> zero
> degree temperature or that no data is available. Importing a 0°C if it
> was
> actually 30°C will cause lots of support requests.
If the requested temperature isn't available (or not implemented), then
the dc_parser_get_field() function will return DC_STATUS_UNSUPPORTED.
Returning zero or some other magic value to indicate absent data is
indeed not a good idea.
> The same goes for the salinity header value. I still would like to
> suggest
> adding a dc_water_t.DC_WATER_UNKNOWN flag type as default value,
> because
> there are many computers out there which don't support salinity
> setting. In
> the end the unavailable data is imported as fresh water instead of
> "unknown/not set".
Same here. If salinity isn't available (or not implemented) the function
will fail with DC_STATUS_UNSUPPORTED. In that case, it will not return
any data back. If you get back DC_WATER_FRESH, that means you
initialized the dc_salinity_t struct with that value. The value of
DC_WATER_FRESH is zero, so if .NET does initialize variables to zero by
default, that could explain why you appear to get back DC_WATER_FRESH.
So make sure to check the return value.
Jef
More information about the devel
mailing list