From dc4b2e05924982a6d0b0264f182124a33a270ef0 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 7 May 2020 12:23:02 -0700 Subject: [PATCH] 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 --- include/libdivecomputer/parser.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/libdivecomputer/parser.h b/include/libdivecomputer/parser.h index fdc5ea1..032e92a 100644 --- a/include/libdivecomputer/parser.h +++ b/include/libdivecomputer/parser.h @@ -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;