From 51d6074bfedfbcdc69ee55d74d321e47bbd59e9e Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 9 May 2013 11:09:00 +0200 Subject: [PATCH] Use a new xml element for the gaschange events. The new xml element makes the the gaschange events stand out more against the other less important events. At the same time it also demonstrates the decoding of the packed oxygen and helium percentages. --- examples/universal.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/universal.c b/examples/universal.c index 51d1044..e0cb4e7 100644 --- a/examples/universal.c +++ b/examples/universal.c @@ -266,8 +266,16 @@ sample_cb (dc_sample_type_t type, dc_sample_value_t value, void *userdata) fprintf (sampledata->fp, " %.2f\n", value.temperature); break; case DC_SAMPLE_EVENT: - fprintf (sampledata->fp, " %s\n", - value.event.type, value.event.time, value.event.flags, value.event.value, events[value.event.type]); + if (value.event.type == SAMPLE_EVENT_GASCHANGE2) { + fprintf (sampledata->fp, " \n", + value.event.value & 0xFFFF, (value.event.value >> 16) & 0xFFFF); + } else if (value.event.type == SAMPLE_EVENT_GASCHANGE) { + fprintf (sampledata->fp, " \n", + value.event.value); + } else { + fprintf (sampledata->fp, " %s\n", + value.event.type, value.event.time, value.event.flags, value.event.value, events[value.event.type]); + } break; case DC_SAMPLE_RBT: fprintf (sampledata->fp, " %u\n", value.rbt);