C++: Add Configurable::config_keys() method.
This commit is contained in:
parent
59b74d28c9
commit
d54190a363
|
@ -358,6 +358,28 @@ Glib::VariantContainerBase Configurable::config_list(const ConfigKey *key)
|
|||
return Glib::VariantContainerBase(data);
|
||||
}
|
||||
|
||||
vector<const ConfigKey *> Configurable::config_keys(const ConfigKey *key)
|
||||
{
|
||||
GVariant *gvar_opts;
|
||||
gsize num_opts;
|
||||
const int32_t *opts;
|
||||
vector<const ConfigKey *> result;
|
||||
|
||||
check(sr_config_list(
|
||||
config_driver, config_sdi, config_channel_group,
|
||||
key->get_id(), &gvar_opts));
|
||||
|
||||
opts = (const int32_t *) g_variant_get_fixed_array(
|
||||
gvar_opts, &num_opts, sizeof(int32_t));
|
||||
|
||||
for (gsize i = 0; i < num_opts; i++)
|
||||
result.push_back(ConfigKey::get(opts[i]));
|
||||
|
||||
g_variant_unref(gvar_opts);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Device::Device(struct sr_dev_inst *structure) :
|
||||
Configurable(structure->driver, structure, NULL),
|
||||
structure(structure)
|
||||
|
|
|
@ -295,6 +295,8 @@ public:
|
|||
/** Enumerate available values for the given configuration key.
|
||||
* @param key ConfigKey to enumerate values for. */
|
||||
Glib::VariantContainerBase config_list(const ConfigKey *key);
|
||||
/** Enumerate available keys, according to a given index key. */
|
||||
vector<const ConfigKey *> config_keys(const ConfigKey *key);
|
||||
protected:
|
||||
Configurable(
|
||||
struct sr_dev_driver *driver,
|
||||
|
|
Loading…
Reference in New Issue