Add string event sample type

A lot of dive computers have fairly arbitrary events that are not really
amenable to the simplistic static enumerated values that libdivecomputer
traditionally uses.

In fact, some dive computers (particularly the newer Suunto ones) very
explicitly report strings natively, with events literally being
described with a string like "Below Wet Activation Depth".

So instead of trying to turn these strings into one of the enumerated
values (and have the dive log software try to turn them back into some
random string when showing the user), just report the string itself.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2020-05-07 12:23:02 -07:00
parent 15c23eb7f6
commit dc4b2e0592

View File

@ -100,8 +100,12 @@ typedef enum parser_sample_event_t {
SAMPLE_EVENT_HEADING,
SAMPLE_EVENT_TISSUELEVEL,
SAMPLE_EVENT_GASCHANGE2, /* Deprecated: replaced by DC_SAMPLE_GASMIX. */
SAMPLE_EVENT_STRING,
} parser_sample_event_t;
/* To let the compile know we have this */
#define SAMPLE_EVENT_STRING SAMPLE_EVENT_STRING
/* For backwards compatibility */
#define SAMPLE_EVENT_UNKNOWN SAMPLE_EVENT_FLOOR
@ -217,6 +221,7 @@ typedef union dc_sample_value_t {
unsigned int time;
unsigned int flags;
unsigned int value;
const char *name;
} event;
unsigned int rbt;
unsigned int heartbeat;