X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdevice%2Fdevinst.cpp;h=f85c6f5e0dd7ea8756784521f6eca36df2e60af8;hb=2445160a5d1eb98196d2a1d57246d4c37dd13811;hp=7440995193be1222eff7d433e65a16e6a7eb0ad1;hpb=07dcf5615620315f4eda91a930b8540e64b625f2;p=pulseview.git diff --git a/pv/device/devinst.cpp b/pv/device/devinst.cpp index 7440995..f85c6f5 100644 --- a/pv/device/devinst.cpp +++ b/pv/device/devinst.cpp @@ -36,12 +36,11 @@ DevInst::DevInst() : { } -void DevInst::use(SigSession *owner) +void DevInst::use(SigSession *owner) throw(QString) { assert(owner); assert(!_owner); _owner = owner; - sr_dev_open(dev_inst()); } void DevInst::release() @@ -49,7 +48,6 @@ void DevInst::release() if (_owner) { _owner->release_device(this); _owner = NULL; - sr_dev_close(dev_inst()); } } @@ -58,9 +56,10 @@ SigSession* DevInst::owner() const return _owner; } -GVariant* DevInst::get_config(const sr_probe_group *group, int key) +GVariant* DevInst::get_config(const sr_channel_group *group, int key) { GVariant *data = NULL; + assert(_owner); sr_dev_inst *const sdi = dev_inst(); assert(sdi); if (sr_config_get(sdi->driver, sdi, group, key, &data) != SR_OK) @@ -68,8 +67,9 @@ GVariant* DevInst::get_config(const sr_probe_group *group, int key) return data; } -bool DevInst::set_config(const sr_probe_group *group, int key, GVariant *data) +bool DevInst::set_config(const sr_channel_group *group, int key, GVariant *data) { + assert(_owner); sr_dev_inst *const sdi = dev_inst(); assert(sdi); if(sr_config_set(sdi, group, key, data) == SR_OK) { @@ -79,9 +79,10 @@ bool DevInst::set_config(const sr_probe_group *group, int key, GVariant *data) return false; } -GVariant* DevInst::list_config(const sr_probe_group *group, int key) +GVariant* DevInst::list_config(const sr_channel_group *group, int key) { GVariant *data = NULL; + assert(_owner); sr_dev_inst *const sdi = dev_inst(); assert(sdi); if (sr_config_list(sdi->driver, sdi, group, key, &data) != SR_OK) @@ -91,6 +92,7 @@ GVariant* DevInst::list_config(const sr_probe_group *group, int key) void DevInst::enable_probe(const sr_probe *probe, bool enable) { + assert(_owner); sr_dev_inst *const sdi = dev_inst(); assert(sdi); for (const GSList *p = sdi->probes; p; p = p->next) @@ -122,5 +124,16 @@ bool DevInst::is_trigger_enabled() const return false; } +void DevInst::start() +{ + if (sr_session_start() != SR_OK) + throw tr("Failed to start session."); +} + +void DevInst::run() +{ + sr_session_run(); +} + } // device } // pv