From: Uwe Hermann Date: Sat, 28 May 2016 15:47:00 +0000 (+0200) Subject: teleinfo: Convert to SR_DF_ANALOG. X-Git-Tag: libsigrok-0.5.0~317 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c8d9a71e436c1ae3f4f2e9c2fed6c873247e2308;p=libsigrok.git teleinfo: Convert to SR_DF_ANALOG. --- diff --git a/src/hardware/teleinfo/protocol.c b/src/hardware/teleinfo/protocol.c index 9cb9ca82..54be6252 100644 --- a/src/hardware/teleinfo/protocol.c +++ b/src/hardware/teleinfo/protocol.c @@ -56,10 +56,13 @@ static struct sr_channel *teleinfo_find_channel(struct sr_dev_inst *sdi, } static void teleinfo_send_value(struct sr_dev_inst *sdi, const char *channel_name, - float value, int mq, int unit) + float value, enum sr_mq mq, enum sr_unit unit) { struct sr_datafeed_packet packet; - struct sr_datafeed_analog_old analog; + struct sr_datafeed_analog analog; + struct sr_analog_encoding encoding; + struct sr_analog_meaning meaning; + struct sr_analog_spec spec; struct sr_channel *ch; ch = teleinfo_find_channel(sdi, channel_name); @@ -67,17 +70,17 @@ static void teleinfo_send_value(struct sr_dev_inst *sdi, const char *channel_nam if (!ch || !ch->enabled) return; - memset(&analog, 0, sizeof(struct sr_datafeed_analog_old)); - analog.channels = g_slist_append(analog.channels, ch); + sr_analog_init(&analog, &encoding, &meaning, &spec, 0); + analog.meaning->channels = g_slist_append(analog.meaning->channels, ch); analog.num_samples = 1; - analog.mq = mq; - analog.unit = unit; + analog.meaning->mq = mq; + analog.meaning->unit = unit; analog.data = &value; - packet.type = SR_DF_ANALOG_OLD; + packet.type = SR_DF_ANALOG; packet.payload = &analog; sr_session_send(sdi, &packet); - g_slist_free(analog.channels); + g_slist_free(analog.meaning->channels); } static void teleinfo_handle_measurement(struct sr_dev_inst *sdi,