]> sigrok.org Git - pulseview.git/commitdiff
Device: add support for list of discrete values for probe factor
authorAurelien Jacobs <redacted>
Sat, 25 Jun 2016 19:44:46 +0000 (21:44 +0200)
committerUwe Hermann <redacted>
Sun, 26 Jun 2016 17:10:55 +0000 (19:10 +0200)
pv/binding/device.cpp
pv/binding/device.hpp

index 27a1a38adee15877bb1c0eefe162a4566fa9b7d5..521177ad4bfd3f7fb64a70d9c5f66fd726050aec 100644 (file)
@@ -123,7 +123,10 @@ Device::Device(shared_ptr<sigrok::Configurable> configurable) :
                        break;
 
                case SR_CONF_PROBE_FACTOR:
-                       bind_int(name, "", pair<int64_t, int64_t>(1, 500), get, set);
+                       if (capabilities.count(Capability::LIST))
+                               bind_enum(name, key, capabilities, get, set, print_probe_factor);
+                       else
+                               bind_int(name, "", pair<int64_t, int64_t>(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
index 563132a205699427ad1903cfab5fd78b1b0e1fe6..9d879ee58186680a01301e59c1f6e406e8d627cf 100644 (file)
@@ -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<sigrok::Configurable> configurable_;