]> sigrok.org Git - pulseview.git/commitdiff
Moved SigSession::is_trigger_enabled into DevInst
authorJoel Holdsworth <redacted>
Sat, 22 Feb 2014 12:57:04 +0000 (12:57 +0000)
committerJoel Holdsworth <redacted>
Sat, 1 Mar 2014 11:02:11 +0000 (11:02 +0000)
pv/device/device.cpp
pv/device/device.h
pv/device/devinst.cpp
pv/device/devinst.h
pv/sigsession.cpp
pv/sigsession.h

index be25b5cb1cd017abb7ae0dd46f55650aeeb31878..4a3ec35f1869364c04f02da03f2577c36cdcf7f8 100644 (file)
@@ -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
index 2abacbc46b692d60df4f25eacfbe49c6dc99bb97..fcf74c31acb1a46b792418ecbcede244859a93a3 100644 (file)
@@ -35,6 +35,8 @@ public:
 
        std::string format_device_title() const;
 
+       bool is_trigger_enabled() const;
+
 private:
        sr_dev_inst *const _sdi;
 };
index 44c1a83154f1f5b046290353a0ddbc4beb36b2da..7440995193be1222eff7d433e65a16e6a7eb0ad1 100644 (file)
@@ -117,5 +117,10 @@ uint64_t DevInst::get_sample_limit()
        return sample_limit;
 }
 
+bool DevInst::is_trigger_enabled() const
+{
+       return false;
+}
+
 } // device
 } // pv
index fb0b7dfbb89f1ce3d96366952f8198d3bac2fed3..5ee387477a7e0119ddb7331bc4271496687c916a 100644 (file)
@@ -75,6 +75,8 @@ public:
         */
        uint64_t get_sample_limit();
 
+       virtual bool is_trigger_enabled() const;
+
 signals:
        void config_changed();
 
index 90fb2798abb7f5aa63e766c9973b0cc61c71fc5d..9af7df74e7a5f967023a20a62c4f6e68ed3d8c16 100644 (file)
@@ -479,20 +479,6 @@ void SigSession::update_signals(shared_ptr<device::DevInst> 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<view::Signal> SigSession::signal_from_probe(
        const sr_probe *probe) const
 {
@@ -596,7 +582,8 @@ void SigSession::sample_thread_proc(shared_ptr<device::DevInst> 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();
index bed7474d12957eeb578d4d91b7d465af36b65ae6..39e4af6802818a1e3fa950eb5058704d22b85b31 100644 (file)
@@ -113,8 +113,6 @@ private:
 
        void update_signals(boost::shared_ptr<device::DevInst> dev_inst);
 
-       bool is_trigger_enabled() const;
-
        boost::shared_ptr<view::Signal> signal_from_probe(
                const sr_probe *probe) const;