]> sigrok.org Git - libsigrok.git/commitdiff
uni-t-ut181a: comment on how to start a recording
authorGerhard Sittig <redacted>
Mon, 1 Jun 2020 08:23:38 +0000 (10:23 +0200)
committerUwe Hermann <redacted>
Mon, 1 Jun 2020 16:35:05 +0000 (18:35 +0200)
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.

src/hardware/uni-t-ut181a/api.c

index 0beb2245cf405bc4a53534125e80825d90209452..de64f2f273f1319f6fbeb207ed433014b70e1525 100644 (file)
@@ -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_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,
 };
        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;
 {
        struct dev_context *devc;
        ssize_t idx;
+       gboolean on;
        GVariant *tuple_child;
        enum sr_mq mq;
        enum sr_mqflag mqflags;
        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;
                        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;
        case SR_CONF_MEASURED_QUANTITY:
                if (!devc)
                        return SR_ERR_ARG;