From: Gerhard Sittig Date: Mon, 1 Jun 2020 08:23:38 +0000 (+0200) Subject: uni-t-ut181a: comment on how to start a recording X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=cbfaf5e073765175236d562c05f21fef9d9cd54f;p=libsigrok.git uni-t-ut181a: comment on how to start a recording The meter allows remote controlled start of recordings, but requires a few parameters where it's uncertain how to most appropriately get these by means of SR_CONF_* keys. Introduce SR_CONF_SET support for SR_CONF_DATALOG to raise awareness, but leave the implementation empty for now. Leave a TODO comment which discusses the meter's commands that one might want to use from here. --- diff --git a/src/hardware/uni-t-ut181a/api.c b/src/hardware/uni-t-ut181a/api.c index 0beb2245..de64f2f2 100644 --- a/src/hardware/uni-t-ut181a/api.c +++ b/src/hardware/uni-t-ut181a/api.c @@ -37,7 +37,8 @@ static const uint32_t devopts[] = { SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET, SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET, SR_CONF_DATA_SOURCE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, - SR_CONF_DATALOG | SR_CONF_GET, + SR_CONF_DATALOG | SR_CONF_GET | SR_CONF_SET, + /* TODO SR_CONF_DATALOG is bool only, how to setup interval/duration? */ SR_CONF_MEASURED_QUANTITY | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_RANGE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, }; @@ -335,6 +336,7 @@ static int config_set(uint32_t key, GVariant *data, { struct dev_context *devc; ssize_t idx; + gboolean on; GVariant *tuple_child; enum sr_mq mq; enum sr_mqflag mqflags; @@ -377,6 +379,22 @@ static int config_set(uint32_t key, GVariant *data, return SR_ERR_ARG; devc->data_source = DATA_SOURCE_REC_FIRST + rec_no - 1; break; + case SR_CONF_DATALOG: + if (!devc) + return SR_ERR_ARG; + on = g_variant_get_boolean(data); + sr_err("DIAG: record start/stop %d, currently ENOIMPL", on); + return SR_ERR_NA; + /* + * TODO Send command 0x0a (start) or 0x0b (stop). Though + * start needs a name (ymd timestamp?) and interval and + * duration (arbitrary choice? 1s for 1d?). Or shall this + * SET request control "save" items instead? Take one + * sample each for every 'datalog=on' request? Combine + * limit_samples and limit_msec with datalog to configure + * a recording's parameters? + */ + break; case SR_CONF_MEASURED_QUANTITY: if (!devc) return SR_ERR_ARG;