return Glib::VariantContainerBase(data);
}
-vector<const ConfigKey *> Configurable::config_keys(const ConfigKey *key)
+map<const ConfigKey *, set<Capability>> Configurable::config_keys(const ConfigKey *key)
{
GVariant *gvar_opts;
gsize num_opts;
const uint32_t *opts;
- vector<const ConfigKey *> result;
+ map<const ConfigKey *, set<Capability>> result;
check(sr_config_list(
config_driver, config_sdi, config_channel_group,
gvar_opts, &num_opts, sizeof(uint32_t));
for (gsize i = 0; i < num_opts; i++)
- result.push_back(ConfigKey::get(opts[i] & SR_CONF_MASK));
+ {
+ auto key = ConfigKey::get(opts[i] & SR_CONF_MASK);
+ set<Capability> capabilities;
+ if (opts[i] & SR_CONF_GET)
+ capabilities.insert(GET);
+ if (opts[i] & SR_CONF_SET)
+ capabilities.insert(SET);
+ if (opts[i] & SR_CONF_LIST)
+ capabilities.insert(LIST);
+ result[key] = capabilities;
+ }
g_variant_unref(gvar_opts);
#include <memory>
#include <vector>
#include <map>
+#include <set>
namespace sigrok
{
friend class Driver;
};
+enum Capability {
+ GET = SR_CONF_GET,
+ SET = SR_CONF_SET,
+ LIST = SR_CONF_LIST
+};
+
/** An object that can be configured. */
class SR_API Configurable
{
* @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);
+ map<const ConfigKey *, set<Capability> > config_keys(const ConfigKey *key);
/** Check for a key in the list from a given index key. */
bool config_check(const ConfigKey *key, const ConfigKey *index_key);
protected: