]> sigrok.org Git - pulseview.git/blobdiff - pv/prop/binding/deviceoptions.h
Added probe group support to DeviceOptions binding
[pulseview.git] / pv / prop / binding / deviceoptions.h
index 23db4f719bf4cec09812f01db01e859103f54000..ab0f01716f0377c563c5288a14050bed8ea7fae2 100644 (file)
@@ -21,6 +21,9 @@
 #ifndef PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H
 #define PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H
 
+#include <boost/function.hpp>
+#include <boost/optional.hpp>
+
 #include <QString>
 
 #include <libsigrok/libsigrok.h>
@@ -34,36 +37,33 @@ namespace binding {
 class DeviceOptions : public Binding
 {
 public:
-       DeviceOptions(struct sr_dev_inst *sdi);
+       DeviceOptions(const sr_dev_inst *sdi,
+               const sr_probe_group *group = NULL);
 
 private:
-       void expose_enum(const struct sr_config_info *info,
-               const std::vector<std::pair<const void*, QString> > &values,
-               int opt);
-
-       void bind_stropt(const struct sr_config_info *info, int key);
 
-       void bind_samplerate(const struct sr_config_info *info);
-       void bind_buffer_size(const struct sr_config_info *info);
-       void bind_time_base(const struct sr_config_info *info);
-       void bind_vdiv(const struct sr_config_info *info);
+       static GVariant* config_getter(
+               const sr_dev_inst *sdi, const sr_probe_group *group, int key);
+       static void config_setter(
+               const sr_dev_inst *sdi, const sr_probe_group *group, int key,
+               GVariant* value);
 
-private:
-       static const void* enum_getter(
-               const struct sr_dev_inst *sdi, int key);
+       void bind_bool(const QString &name, int key);
+       void bind_enum(const QString &name, int key,
+               GVariant *const gvar_list,
+               boost::function<QString (GVariant*)> printer = print_gvariant);
+       void bind_int(const QString &name, int key, QString suffix,
+               boost::optional< std::pair<int64_t, int64_t> > range);
 
-       static double samplerate_value_getter(
-               const struct sr_dev_inst *sdi);
-       static void samplerate_value_setter(
-               struct sr_dev_inst *sdi, double value);
+       static QString print_gvariant(GVariant *const gvar);
 
-       static const void* samplerate_list_getter(
-               const struct sr_dev_inst *sdi);
-       static void samplerate_list_setter(
-               struct sr_dev_inst *sdi, const void* value);
+       static QString print_timebase(GVariant *const gvar);
+       static QString print_vdiv(GVariant *const gvar);
+       static QString print_voltage_threshold(GVariant *const gvar);
 
 protected:
-       struct sr_dev_inst *const _sdi;
+       const sr_dev_inst *const _sdi;
+       const sr_probe_group *const _group;
 };
 
 } // binding