#include <stdint.h>
+#include <QDebug>
+
#include "deviceoptions.h"
#include <pv/device/devinst.h>
#include <libsigrok/libsigrok.h>
using boost::bind;
-using boost::function;
+using std::function;
using boost::optional;
-using boost::shared_ptr;
using std::make_pair;
using std::pair;
+using std::shared_ptr;
using std::string;
using std::vector;
namespace binding {
DeviceOptions::DeviceOptions(shared_ptr<pv::device::DevInst> dev_inst,
- const sr_probe_group *group) :
+ const sr_channel_group *group) :
_dev_inst(dev_inst),
_group(group)
{
vector< pair<GVariant*, QString> > values;
assert(_dev_inst);
- assert(gvar_list);
+ if (!gvar_list) {
+ qDebug() << "Config key " << key << " was listed, but no "
+ "options were given";
+ return;
+ }
g_variant_iter_init (&iter, gvar_list);
while ((gvar = g_variant_iter_next_value (&iter)))
bind(&device::DevInst::set_config, _dev_inst, _group, key, _1))));
}
-QString DeviceOptions::print_gvariant(GVariant *const gvar)
-{
- QString s;
-
- if (g_variant_is_of_type(gvar, G_VARIANT_TYPE("s")))
- s = QString::fromUtf8(g_variant_get_string(gvar, NULL));
- else
- {
- gchar *const text = g_variant_print(gvar, FALSE);
- s = QString::fromUtf8(text);
- g_free(text);
- }
-
- return s;
-}
-
QString DeviceOptions::print_timebase(GVariant *const gvar)
{
uint64_t p, q;