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

Jef Driesen jef at libdivecomputer.org
Fri Aug 22 06:53:05 PDT 2014


On 2014-08-22 13:29, Calle Gunnarsson wrote:
> And implemented this for Cressi Leonardo, see the attached patches.

Great! Together with the tank pressure, this is one of the most often 
requested features. See libdivecomputer tickets #3 and #4 [1-2]. It's 
also one of the things I consider a mandatory feature for the next v0.5 
version, which I hope to release around the end of September. So I'm 
very happy to see your patches.

[1] http://trac.libdivecomputer.org/ticket/3
[2] http://trac.libdivecomputer.org/ticket/4


For the new temperature and tank pressure feature, we'll need at least 
two new DC_FIELD_{TEMPERATURE,TANKPRESSURE} enum values and the 
corresponding dataformats. And that's where we can use some feedback 
from the application developers, because we need to get this right from 
the start (see the explanation at the end of this email). Or at least 
good enough to be useful :-)

Calle's patch uses a double for the temperature, which I think is fine. 
I remember that a while ago there was some discussion about defining the 
exact meaning of such temperature field. Keep in mind that not all dive 
computer store the same kind of temperature value(s). Some may record 
the minimum or maximum temperature, the temperature at maximum depth, 
etc. Others may even record several values. I think trying to support 
all these variants will quickly end up in a mess, so I'm fine to provide 
just a single value without attaching any particular meaning. Of course 
the interpretation will always be fixed within a particular backend, but 
temperature values from different backends may have a slightly different 
interpretation.

For the tank pressure, we certainly need support for multiple tanks, so 
my proposal is to add DC_FIELD_TANKPRESSURE along with a 
DC_FIELD_TANKPRESSURE_COUNT. That's consistent with what we already have 
for the gasmixes. For the corresponding data structure, I propose this:

typedef struct dc_tankpressure_t {
     double begin;
     double end;
} dc_tankpressure_t;

That would be consistent with the data that is delivered in the samples 
(e.g. a pressure value with a tank id). The begin/end fields would 
simply correspond to the value of the first/last sample. So no attempt 
to add tank size (which not many dive computers support) or anything 
else.

Comments are welcome!


Note that after the v0.5 release, I'm planning to introduce some 
architectural changes to fix some long standing design flaws and make 
the library easier to use. Unfortunately those changes will 
significantly break backwards compatibility, and therefore I expect 
applications will (have to) stick to the stable branch for a long while. 
Because on the stable branch only backwards compatible changes are 
acceptable, the data format of these will essentially be fixed. So we 
better do get this right while we can.

Jef


More information about the devel mailing list