]> sigrok.org Git - libsigrok.git/commitdiff
scpi-dmm: add support for model specific device options
authorGerhard Sittig <redacted>
Sat, 17 Nov 2018 15:26:51 +0000 (16:26 +0100)
committerGerhard Sittig <redacted>
Sat, 17 Nov 2018 19:08:59 +0000 (20:08 +0100)
Supported SCPI DMM devices will differ in the set of options and whether
parameters can get queried or configured. Use a "generic" set of devopts
during scan and for simpler models, prepare support for other sets of
devopts for more complex models.

src/hardware/scpi-dmm/api.c
src/hardware/scpi-dmm/protocol.h

index 011f57b5c1806afcac4a793070953d4166fd6dab..f6820de389c97938780dd290ab696d5d47cf421b 100644 (file)
@@ -31,7 +31,7 @@ static const uint32_t drvopts[] = {
        SR_CONF_MULTIMETER,
 };
 
-static const uint32_t devopts[] = {
+static const uint32_t devopts_generic[] = {
        SR_CONF_CONTINUOUS,
        SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
        SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
@@ -68,6 +68,7 @@ SR_PRIV const struct scpi_dmm_model models[] = {
                "Agilent", "34405A",
                1, 5, cmdset_agilent, ARRAY_AND_SIZE(mqopts_agilent_5digit),
                scpi_dmm_get_meas_agilent,
+               ARRAY_AND_SIZE(devopts_generic),
        },
 };
 
@@ -246,7 +247,12 @@ static int config_list(uint32_t key, GVariant **data,
        switch (key) {
        case SR_CONF_SCAN_OPTIONS:
        case SR_CONF_DEVICE_OPTIONS:
-               return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
+               if (!devc)
+                       return STD_CONFIG_LIST(key, data, sdi, cg,
+                               scanopts, drvopts, devopts_generic);
+               return std_opts_config_list(key, data, sdi, cg,
+                       ARRAY_AND_SIZE(scanopts), ARRAY_AND_SIZE(drvopts),
+                       devc->model->devopts, devc->model->devopts_size);
        case SR_CONF_MEASURED_QUANTITY:
                /* TODO Use std_gvar_measured_quantities() when available. */
                if (!devc)
index 0881074ce9ef2715b381c60d98bbb78bd9fd9955..dbca1bcf4e3cffd305a490c4901588858c91a3d6 100644 (file)
@@ -60,6 +60,8 @@ struct scpi_dmm_model {
        const struct mqopt_item *mqopts;
        size_t mqopt_size;
        int (*get_measurement)(const struct sr_dev_inst *sdi, size_t ch);
+       const uint32_t *devopts;
+       size_t devopts_size;
 };
 
 struct dev_context {