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 <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2016-07-21 08:45:37 +09:00 committed by Dirk Hohndel
parent 3547c72111
commit 5d4e1f97db

View File

@ -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)