- if (devc->state == STATE_VOLTAGE) {
- /* Just got voltage, request current for this channel. */
- devc->state = STATE_CURRENT;
- scpi_cmd(sdi, SCPI_CMD_GET_MEAS_CURRENT, devc->cur_channel->name);
- } else if (devc->state == STATE_CURRENT) {
- /*
- * Done with voltage and current for this channel, switch to
- * the next enabled channel.
- */
- do {
- l = g_slist_find(sdi->channels, devc->cur_channel);
- if (l->next)
- devc->cur_channel = l->next->data;
- else
- devc->cur_channel = sdi->channels->data;
- } while (!devc->cur_channel->enabled);
-
- /* Request voltage. */
- devc->state = STATE_VOLTAGE;
- scpi_cmd(sdi, SCPI_CMD_GET_MEAS_VOLTAGE, devc->cur_channel->name);
- }
+ /* Find next enabled channel. */
+ do {
+ l = g_slist_find(sdi->channels, devc->cur_channel);
+ if (l->next)
+ devc->cur_channel = l->next->data;
+ else
+ devc->cur_channel = sdi->channels->data;
+ } while (!devc->cur_channel->enabled);
+
+ pch = devc->cur_channel->priv;
+ if (pch->mq == SR_MQ_VOLTAGE)
+ cmd = SCPI_CMD_GET_MEAS_VOLTAGE;
+ else if (pch->mq == SR_MQ_CURRENT)
+ cmd = SCPI_CMD_GET_MEAS_CURRENT;
+ else if (pch->mq == SR_MQ_POWER)
+ cmd = SCPI_CMD_GET_MEAS_POWER;
+ else
+ return SR_ERR;
+ scpi_cmd(sdi, cmd, pch->hwname);