X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdevinst.cpp;h=c0b87fe243414bf5167f7af7f49aed527367d124;hb=e183f4e328db8bb134652254ba9bf0707dc16c66;hp=4a152e0c6b6d119d53d7608db2817157403eff73;hpb=19adbc2c342b190161ec1223377a3619974b91f7;p=pulseview.git diff --git a/pv/devinst.cpp b/pv/devinst.cpp index 4a152e0..c0b87fe 100644 --- a/pv/devinst.cpp +++ b/pv/devinst.cpp @@ -21,6 +21,8 @@ #include #include +#include + #include #include "devinst.h" @@ -66,4 +68,41 @@ string DevInst::format_device_title() const return s.str(); } +GVariant* DevInst::get_config(const sr_probe_group *group, int key) +{ + GVariant *data = NULL; + if (sr_config_get(_sdi->driver, _sdi, group, key, &data) != SR_OK) + return NULL; + return data; +} + +bool DevInst::set_config(const sr_probe_group *group, int key, GVariant *data) +{ + if(sr_config_set(_sdi, group, key, data) == SR_OK) { + config_changed(); + return true; + } + return false; +} + +GVariant* DevInst::list_config(const sr_probe_group *group, int key) +{ + GVariant *data = NULL; + if (sr_config_list(_sdi->driver, _sdi, group, key, &data) != SR_OK) + return NULL; + return data; +} + +void DevInst::enable_probe(const sr_probe *probe, bool enable) +{ + for (const GSList *p = _sdi->probes; p; p = p->next) + if (probe == p->data) { + const_cast(probe)->enabled = enable; + return; + } + + // Probe was not found in the device + assert(0); +} + } // pv