2 Commits

Author SHA1 Message Date
Linus Torvalds
e9129ff45a Add generic dc_field_get() helper
This generic helper just gets everything from the field cache.

Dive computers can do their own things for any field they handle
differently, and then at the end fall back to this for all of the common
cases that are purely described by the field cache structure.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-22 14:56:55 -07:00
Linus Torvalds
af2249a7c5 Add generic field cache and string field infrastructure
This adds the infrastructure for the "field cache", which is just
various helpers for the dc_get_field() interface.

This includes the 'dc_field_cache_t' structure that a libdivecomputer
backend can just add to its parser data structure, and a few macros to
make it very easy to initialize the fields and then return them in the
'get_field()' callback.

And part of it is the infrastructure support for the 'dc_field_string_t'
type, which adds the support for string fields.  That will be used to
return various string-formatted data from the dive computer, like deco
models, serial numbers, etc.

And no, a serial number is most definitely not a "number". It's a string.

Right now there are no users of this yet, that comes next.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-05-07 15:05:30 -07:00