X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;ds=sidebyside;f=pv%2Fsigsession.cpp;h=9af7df74e7a5f967023a20a62c4f6e68ed3d8c16;hb=2445d0b3d64ab051d8a686506910224f9f4e45c7;hp=aab5be7d23bcb5b4ba2ed85d777cb40c5f80c2f7;hpb=85843b14c48affe67820ec8c9e357cd26e0ed943;p=pulseview.git diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index aab5be7..9af7df7 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -80,9 +80,7 @@ SigSession::~SigSession() if (_sampling_thread.joinable()) _sampling_thread.join(); - shared_ptr device(dynamic_pointer_cast(_dev_inst)); - if (device) - _device_manager.release_device(device); + _dev_inst->release(); // TODO: This should not be necessary _session = NULL; @@ -100,21 +98,20 @@ void SigSession::set_device(shared_ptr dev_inst) // Ensure we are not capturing before setting the device stop_capture(); - shared_ptr old_device(dynamic_pointer_cast(_dev_inst)); - if (old_device) - _device_manager.release_device(old_device); + if (_dev_inst) + _dev_inst->release(); - shared_ptr new_device(dynamic_pointer_cast(dev_inst)); - if (new_device) - _device_manager.use_device(new_device, this); + if (dev_inst) + dev_inst->use(this); _dev_inst = dev_inst; update_signals(dev_inst); } -void SigSession::release_device(shared_ptr dev_inst) +void SigSession::release_device(device::DevInst *dev_inst) { (void)dev_inst; + assert(_dev_inst.get() == dev_inst); assert(_capture_state == Stopped); _dev_inst = shared_ptr(); @@ -482,20 +479,6 @@ void SigSession::update_signals(shared_ptr dev_inst) signals_changed(); } -bool SigSession::is_trigger_enabled() const -{ - assert(_dev_inst); - assert(_dev_inst->dev_inst()); - for (const GSList *l = _dev_inst->dev_inst()->probes; l; l = l->next) { - const sr_probe *const p = (const sr_probe *)l->data; - assert(p); - if (p->trigger && p->trigger[0] != '\0') - return true; - } - - return false; -} - shared_ptr SigSession::signal_from_probe( const sr_probe *probe) const { @@ -599,7 +582,8 @@ void SigSession::sample_thread_proc(shared_ptr dev_inst, return; } - set_capture_state(is_trigger_enabled() ? AwaitingTrigger : Running); + set_capture_state(dev_inst->is_trigger_enabled() ? + AwaitingTrigger : Running); sr_session_run(); sr_session_destroy();