Parsing header and profile data

Jef Driesen jefdriesen at telenet.be
Thu Jan 13 22:58:46 UTC 2011


On 29/07/10 13:48, Jef Driesen wrote:
> Currently, there is no way to retrieve the dive header data (except for
> the date/time). Usually there is lots of additional information present
> that might be useful for an application. As usual, the problem is that
> there is a lot of variation in the information that is stored in this
> header data. There are only a few fields that are always available (or
> can be calculated from the sample data):
>
> [...]
>
> For the api, I have been experimenting with an ioctl() style api:
>
> parser_status_t
> parser_get_field (parser_t *parser, parser_field_type_t type, unsigned
> int flags, void *value);
>
> which you would use as follows:
>
> double maxdepth = 0;
> unsigned int divetime = 0;
> unsigned int ngasmix = 0;
>
> parser_get_field (parser, FIELD_TYPE_DIVETIME, 0,&divetime);
> parser_get_field (parser, FIELD_TYPE_MAXDEPTH, 0,&maxdepth);
> parser_get_field (parser, FIELD_TYPE_GASMIX_COUNT, 0,&ngasmix);
> for (unsigned int i = 0; i<  ngasmix; ++i) {
>       gasmix_t gasmix = {0};
>       parser_get_field (parser, FIELD_TYPE_GASMIX, i,&gasmix);
> }

This new parser_get_field() api is now available in the git repository. Most of 
the decoding should be fine, but of course there may still be a few bugs here 
and there (especially in the gasmix data). Just let me know if you find one.




More information about the Devel mailing list