#include <boost/bind.hpp>
+#include <QDebug>
+
#include "deviceoptions.h"
#include <pv/prop/enum.h>
{
_properties.push_back(shared_ptr<Property>(
new Enum(QString(info->name), values,
- function<const void* ()>(),
+ bind(getter, _sdi, key),
bind(sr_config_set, _sdi, key, _1))));
}
expose_enum(info, values, SR_CONF_VDIV);
}
+const void* DeviceOptions::enum_getter(
+ const struct sr_dev_inst *sdi, int key)
+{
+ const void *data = NULL;
+ if(sr_config_get(sdi->driver, key, &data, sdi) != SR_OK) {
+ qDebug() <<
+ "WARNING: Failed to get value of config id" << key;
+ return NULL;
+ }
+ return data;
+}
+
} // binding
} // prop
} // pv
void bind_time_base(const struct sr_config_info *info);
void bind_vdiv(const struct sr_config_info *info);
+private:
+ static const void* enum_getter(
+ const struct sr_dev_inst *sdi, int key);
+
protected:
struct sr_dev_inst *const _sdi;
};