From: Uwe Hermann Date: Sat, 28 May 2016 15:47:22 +0000 (+0200) Subject: uni-t-dmm: Convert to SR_DF_ANALOG. X-Git-Tag: libsigrok-0.5.0~315 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=dff60e3ccc5da17a0156d3072a0558732c4be94e;p=libsigrok.git uni-t-dmm: Convert to SR_DF_ANALOG. --- diff --git a/src/hardware/uni-t-dmm/protocol.c b/src/hardware/uni-t-dmm/protocol.c index f0b39976..15cdb0c2 100644 --- a/src/hardware/uni-t-dmm/protocol.c +++ b/src/hardware/uni-t-dmm/protocol.c @@ -57,14 +57,17 @@ static void decode_packet(struct sr_dev_inst *sdi, const uint8_t *buf) struct dev_context *devc; struct dmm_info *dmm; 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; float floatval; void *info; int ret; devc = sdi->priv; dmm = (struct dmm_info *)sdi->driver; - memset(&analog, 0, sizeof(struct sr_datafeed_analog_old)); + sr_analog_init(&analog, &encoding, &meaning, &spec, 0); info = g_malloc(dmm->info_size); /* Parse the protocol packet. */ @@ -82,10 +85,10 @@ static void decode_packet(struct sr_dev_inst *sdi, const uint8_t *buf) g_free(info); /* Send a sample packet with one analog value. */ - analog.channels = sdi->channels; + analog.meaning->channels = sdi->channels; analog.num_samples = 1; analog.data = &floatval; - packet.type = SR_DF_ANALOG_OLD; + packet.type = SR_DF_ANALOG; packet.payload = &analog; sr_session_send(sdi, &packet); diff --git a/src/hardware/uni-t-dmm/protocol.h b/src/hardware/uni-t-dmm/protocol.h index 9ec354fb..562cf747 100644 --- a/src/hardware/uni-t-dmm/protocol.h +++ b/src/hardware/uni-t-dmm/protocol.h @@ -37,8 +37,8 @@ struct dmm_info { int packet_size; gboolean (*packet_valid)(const uint8_t *); int (*packet_parse)(const uint8_t *, float *, - struct sr_datafeed_analog_old *, void *); - void (*dmm_details)(struct sr_datafeed_analog_old *, void *); + struct sr_datafeed_analog *, void *); + void (*dmm_details)(struct sr_datafeed_analog *, void *); gsize info_size; };