X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fprop%2Fbinding%2Fdeviceoptions.h;h=a1efd06a3fbc0bed6e42aec944f3315d1b7e3c49;hp=491acfc45703a028f9c083b374713984a0d27d1d;hb=6db7315814ee9d2f92d4b326be7c5b9e6e4b789b;hpb=a2b921574b467fd9193d06497bf0ee058e8f7470 diff --git a/pv/prop/binding/deviceoptions.h b/pv/prop/binding/deviceoptions.h index 491acfc4..a1efd06a 100644 --- a/pv/prop/binding/deviceoptions.h +++ b/pv/prop/binding/deviceoptions.h @@ -21,53 +21,52 @@ #ifndef PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H #define PULSEVIEW_PV_PROP_BINDING_DEVICEOPTIONS_H -#include #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: - - static GVariant* config_getter( - const struct sr_dev_inst *sdi, int key); - static void config_setter( - const struct sr_dev_inst *sdi, int key, GVariant* value); - - void bind_bool(const QString &name, 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, - boost::function printer = print_gvariant); - void bind_int(const QString &name, int key, QString suffix, - boost::optional< std::pair > range); - - static QString print_gvariant(GVariant *const gvar); - - void bind_samplerate(const QString &name, - GVariant *const gvar_list); - static QString print_samplerate(GVariant *const gvar); - static GVariant* samplerate_double_getter( - const struct sr_dev_inst *sdi); - static void samplerate_double_setter( - struct sr_dev_inst *sdi, GVariant *value); + 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); 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