From 07dcf5615620315f4eda91a930b8540e64b625f2 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 22 Feb 2014 12:57:04 +0000 Subject: [PATCH] Moved SigSession::is_trigger_enabled into DevInst --- pv/device/device.cpp | 12 ++++++++++++ pv/device/device.h | 2 ++ pv/device/devinst.cpp | 5 +++++ pv/device/devinst.h | 2 ++ pv/sigsession.cpp | 17 ++--------------- pv/sigsession.h | 2 -- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/pv/device/device.cpp b/pv/device/device.cpp index be25b5cb..4a3ec35f 100644 --- a/pv/device/device.cpp +++ b/pv/device/device.cpp @@ -66,5 +66,17 @@ std::string Device::format_device_title() const return s.str(); } +bool Device::is_trigger_enabled() const +{ + assert(_sdi); + for (const GSList *l = _sdi->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; +} + } // device } // pv diff --git a/pv/device/device.h b/pv/device/device.h index 2abacbc4..fcf74c31 100644 --- a/pv/device/device.h +++ b/pv/device/device.h @@ -35,6 +35,8 @@ public: std::string format_device_title() const; + bool is_trigger_enabled() const; + private: sr_dev_inst *const _sdi; }; diff --git a/pv/device/devinst.cpp b/pv/device/devinst.cpp index 44c1a831..74409951 100644 --- a/pv/device/devinst.cpp +++ b/pv/device/devinst.cpp @@ -117,5 +117,10 @@ uint64_t DevInst::get_sample_limit() return sample_limit; } +bool DevInst::is_trigger_enabled() const +{ + return false; +} + } // device } // pv diff --git a/pv/device/devinst.h b/pv/device/devinst.h index fb0b7dfb..5ee38747 100644 --- a/pv/device/devinst.h +++ b/pv/device/devinst.h @@ -75,6 +75,8 @@ public: */ uint64_t get_sample_limit(); + virtual bool is_trigger_enabled() const; + signals: void config_changed(); diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index 90fb2798..9af7df74 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -479,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 { @@ -596,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(); diff --git a/pv/sigsession.h b/pv/sigsession.h index bed7474d..39e4af68 100644 --- a/pv/sigsession.h +++ b/pv/sigsession.h @@ -113,8 +113,6 @@ private: void update_signals(boost::shared_ptr dev_inst); - bool is_trigger_enabled() const; - boost::shared_ptr signal_from_probe( const sr_probe *probe) const; -- 2.30.2