From: Aurelien Jacobs Date: Sat, 25 Jun 2016 19:44:46 +0000 (+0200) Subject: Device: add support for list of discrete values for probe factor X-Git-Tag: pulseview-0.4.0~284 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=49c62417b6b306607048b07f86b73f127e3084a3;p=pulseview.git Device: add support for list of discrete values for probe factor --- diff --git a/pv/binding/device.cpp b/pv/binding/device.cpp index 27a1a38a..521177ad 100644 --- a/pv/binding/device.cpp +++ b/pv/binding/device.cpp @@ -123,7 +123,10 @@ Device::Device(shared_ptr configurable) : break; case SR_CONF_PROBE_FACTOR: - bind_int(name, "", pair(1, 500), get, set); + if (capabilities.count(Capability::LIST)) + bind_enum(name, key, capabilities, get, set, print_probe_factor); + else + bind_int(name, "", pair(1, 500), get, set); break; default: @@ -192,5 +195,12 @@ QString Device::print_voltage_threshold(Glib::VariantBase gvar) return QString("L<%1V H>%2V").arg(lo, 0, 'f', 1).arg(hi, 0, 'f', 1); } +QString Device::print_probe_factor(Glib::VariantBase gvar) +{ + uint64_t factor; + factor = g_variant_get_uint64(gvar.gobj()); + return QString("%1x").arg(factor); +} + } // binding } // pv diff --git a/pv/binding/device.hpp b/pv/binding/device.hpp index 563132a2..9d879ee5 100644 --- a/pv/binding/device.hpp +++ b/pv/binding/device.hpp @@ -61,6 +61,7 @@ private: static QString print_timebase(Glib::VariantBase gvar); static QString print_vdiv(Glib::VariantBase gvar); static QString print_voltage_threshold(Glib::VariantBase gvar); + static QString print_probe_factor(Glib::VariantBase gvar); protected: std::shared_ptr configurable_;