summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fd66afb)
raw | patch | inline | side by side (parent: fd66afb)
author | Bert Vermeulen <bert@biot.com> | |
Wed, 31 Jul 2013 09:24:36 +0000 (11:24 +0200) | ||
committer | Bert Vermeulen <bert@biot.com> | |
Wed, 31 Jul 2013 09:24:36 +0000 (11:24 +0200) |
src/sigrok.c | patch | blob | history |
diff --git a/src/sigrok.c b/src/sigrok.c
index 28adfbd11b73a08ca9d2de733697b195aab32f05..7e2fa6c1b29ca2990dd5362d4164b69db67bc1df 100644 (file)
--- a/src/sigrok.c
+++ b/src/sigrok.c
return 0;
}
+static char *sigrok_value_type(const struct sr_datafeed_analog *analog)
+{
+ char *s;
+
+ if (analog->mq == SR_MQ_VOLTAGE)
+ s = "voltage";
+ else if (analog->mq == SR_MQ_CURRENT)
+ s = "current";
+ else if (analog->mq == SR_MQ_FREQUENCY)
+ s = "frequency";
+ else if (analog->mq == SR_MQ_POWER)
+ s = "power";
+ else if (analog->mq == SR_MQ_TEMPERATURE)
+ s = "temperature";
+ else if (analog->mq == SR_MQ_RELATIVE_HUMIDITY)
+ s = "humidity";
+ else
+ s = "gauge";
+
+ return s;
+}
+
static void sigrok_feed_callback(const struct sr_dev_inst *sdi,
const struct sr_datafeed_packet *packet, void *cb_data)
{
sstrncpy(vl.plugin, "sigrok", sizeof(vl.plugin));
ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance),
"%s", cfdev->name);
- sstrncpy(vl.type, "gauge", sizeof(vl.type));
+ sstrncpy(vl.type, sigrok_value_type(analog), sizeof(vl.type));
plugin_dispatch_values(&vl);
cfdev->last_dispatch = cdtime();