auto key = entry.first;
auto capabilities = entry.second;
- Glib::VariantContainerBase gvar_list;
-
if (!capabilities.count(Capability::GET) ||
!capabilities.count(Capability::SET))
continue;
- if (capabilities.count(Capability::LIST))
- gvar_list = configurable->config_list(key);
-
string name_str;
try {
name_str = key->description();
case SR_CONF_FILTER:
case SR_CONF_COUPLING:
case SR_CONF_CLOCK_EDGE:
- bind_enum(name, gvar_list, get, set);
+ bind_enum(name, key, capabilities, get, set);
break;
case SR_CONF_EXTERNAL_CLOCK:
break;
case SR_CONF_TIMEBASE:
- bind_enum(name, gvar_list, get, set, print_timebase);
+ bind_enum(name, key, capabilities, get, set, print_timebase);
break;
case SR_CONF_VDIV:
- bind_enum(name, gvar_list, get, set, print_vdiv);
+ bind_enum(name, key, capabilities, get, set, print_vdiv);
break;
case SR_CONF_VOLTAGE_THRESHOLD:
- bind_enum(name, gvar_list, get, set, print_voltage_threshold);
+ bind_enum(name, key, capabilities, get, set, print_voltage_threshold);
break;
default:
}
void Device::bind_enum(const QString &name,
- Glib::VariantContainerBase gvar_list, Property::Getter getter,
+ const ConfigKey *key, std::set<Capability> capabilities,
+ Property::Getter getter,
Property::Setter setter, function<QString (Glib::VariantBase)> printer)
{
Glib::VariantBase gvar;
assert(configurable_);
- Glib::VariantIter iter(gvar_list);
+ if (!capabilities.count(Capability::LIST))
+ return;
+
+ Glib::VariantIter iter(configurable_->config_list(key));
while ((iter.next_value(gvar)))
values.push_back(make_pair(gvar, printer(gvar)));
#include <pv/prop/property.hpp>
-namespace sigrok {
- class Configurable;
-}
+#include <libsigrokcxx/libsigrokcxx.hpp>
namespace pv {
private:
void bind_bool(const QString &name,
prop::Property::Getter getter, prop::Property::Setter setter);
- void bind_enum(const QString &name, Glib::VariantContainerBase gvar_list,
+ void bind_enum(const QString &name,
+ const sigrok::ConfigKey *key, std::set<sigrok::Capability> capabilities,
prop::Property::Getter getter, prop::Property::Setter setter,
std::function<QString (Glib::VariantBase)> printer = print_gvariant);
void bind_int(const QString &name, QString suffix,