libdivecomputer does not return water temperature for uwatec aladin pro

Jef Driesen jef at libdivecomputer.org
Fri Jan 31 01:00:28 UTC 2014


On 2014-01-29 17:35, vavincavent wrote:
>> It's probably a lot easier to implement this on the libdivecomputer 
>> side. You basically need to add a new DC_FIELD_TEMPERATURE to the 
>> enum, along with the necessary code in the backends.
>> 
>> It's not terrible difficult. The main reason why I kept my hands off 
>> doing it myself so far, is that to be really useful, it should be 
>> implemented for all backends. With about 20 parser backends (and many 
>> more due to device specific formats) that means quite some effort and 
>> time (reverse engineering, reading documentation, testing, etc). Since 
>> I already have plenty of work with bugfixing and maintenance, adding 
>> support for new devices, etc there is barely time left for new 
>> features.
>> 
>> But if someone is willing to put some effort in this, I'm happy to 
>> accept patches. Even if it's initially just for one or a few backends. 
>> I wouldn't even mind if the exact semantics aren't well defined at 
>> this point (e.g. Which temperature is this? Minimum, maximum, average 
>> or even something else?). Having something to start with is better 
>> than nothing. We can always improve along the way.
>> 
>> The same also applies for example to features like begin/end tank 
>> pressure. This are all features I would like to support anyway, and 
>> have been on my todo list for way too long already.
>> 
> Ok Jef, i will try in libdivecomputer.
> It will be difficult for me because i'm not a programmer (i am reading
> "apprendre le C"...).
> Just an indication , i have to modify :
> * uwatec_aladin.c
> 
> did i have to modify something else in libdivecomputer? and in 
> subsurface?

Start by adding a new DC_FIELD_TEMPERATURE to the enum in 
include/libdivecomputer/parser.h. Then in the 
uwatec_memomouse_parser_get_field() function in 
uwatec_memomouse_parser.c you add a the new DC_FIELD_TEMPERATURE to the 
switch statement, and add code to return the temperature as a double 
(like is done for DC_FIELD_MAXDEPTH). This kind of modifications to the 
code is very easy (maybe a bit more difficult is you are new to C 
programming). The hardest part is finding out how and where the 
temperature is stored, especially when implementing this for all 
backends.

In subsurface you'll have to call the dc_parser_get_field() function 
with the DC_FIELD_TEMPERATURE type. The same as it's done for the 
DC_FIELD_MAXDEPTH type.

Jef


More information about the subsurface mailing list