X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fprop%2Fbinding%2Fdeviceoptions.h;h=a1efd06a3fbc0bed6e42aec944f3315d1b7e3c49;hp=b622d9379665a014283bb05eea7799907bd97910;hb=6db7315814ee9d2f92d4b326be7c5b9e6e4b789b;hpb=d71bca8b719331690455e3b3aa8aeeba350c9d3a diff --git a/pv/prop/binding/deviceoptions.h b/pv/prop/binding/deviceoptions.h index b622d937..a1efd06a 100644 --- a/pv/prop/binding/deviceoptions.h +++ b/pv/prop/binding/deviceoptions.h @@ -21,38 +21,52 @@ #ifndef PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H #define PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H +#include + #include -#include +#include #include "binding.h" +#include + +struct sr_dev_inst; +struct sr_channel_group; + namespace pv { + +namespace device { +class DevInst; +} + namespace prop { namespace binding { class DeviceOptions : public Binding { public: - DeviceOptions(struct sr_dev_inst *sdi); + DeviceOptions(std::shared_ptr dev_inst, + const sr_channel_group *group = NULL); private: - void expose_enum(const struct sr_config_info *info, - const std::vector > &values, - int opt); - - void bind_stropt(const struct sr_config_info *info, int key); + void bind_bool(const QString &name, + Property::Getter getter, Property::Setter setter); + void bind_enum(const QString &name, int key, + GVariant *const gvar_list, + Property::Getter getter, Property::Setter setter, + std::function printer = print_gvariant); + void bind_int(const QString &name, QString suffix, + boost::optional< std::pair > range, + Property::Getter getter, Property::Setter setter); - 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); - -private: - static const void* enum_getter( - const struct sr_dev_inst *sdi, int key); + 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; + std::shared_ptr _dev_inst; + const sr_channel_group *const _group; }; } // binding