{
}
-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()
if (_owner) {
_owner->release_device(this);
_owner = NULL;
- sr_dev_close(dev_inst());
}
}
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)
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) {
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)
return data;
}
-void DevInst::enable_probe(const sr_probe *probe, bool enable)
+void DevInst::enable_channel(const sr_channel *channel, bool enable)
{
+ assert(_owner);
sr_dev_inst *const sdi = dev_inst();
assert(sdi);
- for (const GSList *p = sdi->probes; p; p = p->next)
- if (probe == p->data) {
- const_cast<sr_probe*>(probe)->enabled = enable;
+ for (const GSList *p = sdi->channels; p; p = p->next)
+ if (channel == p->data) {
+ const_cast<sr_channel*>(channel)->enabled = enable;
config_changed();
return;
}
- // Probe was not found in the device
+ // Channel was not found in the device
assert(0);
}
return sample_limit;
}
+bool DevInst::is_trigger_enabled() const
+{
+ return false;
+}
+
+void DevInst::start()
+{
+ if (sr_session_start(SigSession::_sr_session) != SR_OK)
+ throw tr("Failed to start session.");
+}
+
+void DevInst::run()
+{
+ sr_session_run(SigSession::_sr_session);
+}
+
} // device
} // pv