From 5d4e1f97dbbcec5cac7b3771a57b0c139d3feda1 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 21 Jul 2016 08:45:37 +0900 Subject: [PATCH] Suunto EON Steel: add dive state event reporting Now that we support string events and don't need to try to figure out some libdivecomputer event number that doesn't exist, it's easy to add the proper support for the dive state reporting that the EON Steel has. Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- src/suunto_eonsteel_parser.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/suunto_eonsteel_parser.c b/src/suunto_eonsteel_parser.c index 25153dd..c70edc8 100644 --- a/src/suunto_eonsteel_parser.c +++ b/src/suunto_eonsteel_parser.c @@ -699,22 +699,18 @@ static void sample_event_state_type(const struct type_desc *desc, struct sample_ static void sample_event_state_value(const struct type_desc *desc, struct sample_data *info, unsigned char value) { + dc_sample_value_t sample = {0}; const char *name; name = info->state_type; if (!name) return; - /* - * We could turn these into sample events, but they don't actually - * match any libdivecomputer events. - * - * unsigned int state = info->state_type; - * dc_sample_value_t sample = {0}; - * sample.event.type = ... - * sample.event.value = value; - * if (info->callback) info->callback(DC_SAMPLE_EVENT, sample, info->userdata); - */ + sample.event.type = SAMPLE_EVENT_STRING; + sample.event.name = name; + + sample.event.value = value ? SAMPLE_FLAGS_BEGIN : SAMPLE_FLAGS_END; + if (info->callback) info->callback(DC_SAMPLE_EVENT, sample, info->userdata); } static void sample_event_notify_type(const struct type_desc *desc, struct sample_data *info, unsigned char type)