]> sigrok.org Git - pulseview.git/commitdiff
Moved all sr_probe modification into pv::DevInst
authorJoel Holdsworth <redacted>
Mon, 10 Feb 2014 22:02:44 +0000 (22:02 +0000)
committerJoel Holdsworth <redacted>
Tue, 11 Feb 2014 21:44:46 +0000 (21:44 +0000)
pv/devinst.cpp
pv/devinst.h
pv/view/analogsignal.cpp
pv/view/analogsignal.h
pv/view/logicsignal.cpp
pv/view/logicsignal.h
pv/view/signal.cpp
pv/view/signal.h

index 4cae04aee29a32e8f98a862c0550a98f68957535..c0b87fe243414bf5167f7af7f49aed527367d124 100644 (file)
@@ -93,4 +93,16 @@ GVariant* DevInst::list_config(const sr_probe_group *group, int key)
        return data;
 }
 
+void DevInst::enable_probe(const sr_probe *probe, bool enable)
+{
+       for (const GSList *p = _sdi->probes; p; p = p->next)
+               if (probe == p->data) {
+                       const_cast<sr_probe*>(probe)->enabled = enable;
+                       return;
+               }
+
+       // Probe was not found in the device
+       assert(0);
+}
+
 } // pv
index 400f7c32893be45e7f275ce97eec05e9fb6cb0aa..0ce767452742c691f38b9caf58fa39d35bcfd90c 100644 (file)
@@ -30,6 +30,7 @@
 #include <glib.h>
 
 struct sr_dev_inst;
+struct sr_probe;
 struct sr_probe_group;
 
 namespace pv {
@@ -51,6 +52,8 @@ public:
 
        GVariant* list_config(const sr_probe_group *group, int key);
 
+       void enable_probe(const sr_probe *probe, bool enable = true);
+
 signals:
        void config_changed();
 
index 292d5f9e55809c0cf755af8ace4b141abdd7678c..a64cf70f430dc4fd7c8d8d47432c24f593aa63ed 100644 (file)
@@ -45,7 +45,7 @@ const QColor AnalogSignal::SignalColours[4] = {
 const float AnalogSignal::EnvelopeThreshold = 256.0f;
 
 AnalogSignal::AnalogSignal(shared_ptr<pv::DevInst> dev_inst,
-       sr_probe *const probe, shared_ptr<data::Analog> data) :
+       const sr_probe *const probe, shared_ptr<data::Analog> data) :
        Signal(dev_inst, probe),
        _data(data),
        _scale(1.0f)
index a312b3e8ab41a7387d30348f8abf53970ef72c0c..3b6f7f4f6ef240bfa0bee86202ab67593cd3ae46 100644 (file)
@@ -43,7 +43,7 @@ private:
 
 public:
        AnalogSignal(boost::shared_ptr<pv::DevInst> dev_inst,
-               sr_probe *const probe,
+               const sr_probe *const probe,
                boost::shared_ptr<pv::data::Analog> data);
 
        virtual ~AnalogSignal();
index 7eb56da649b1ab2f68bf05c1819ffd017f5caeff..89c375cc0551cb7689e7b63a4693b70c8d962f3b 100644 (file)
@@ -64,7 +64,7 @@ const QColor LogicSignal::SignalColours[10] = {
 };
 
 LogicSignal::LogicSignal(shared_ptr<pv::DevInst> dev_inst,
-       sr_probe *const probe, shared_ptr<data::Logic> data) :
+       const sr_probe *const probe, shared_ptr<data::Logic> data) :
        Signal(dev_inst, probe),
        _data(data),
        _trigger_none(NULL),
index cc63884e586b9f5ae253067e25aa3303be8af3cc..17f6eb26d862eede6bf8c968d7cb5deee8303bb7 100644 (file)
@@ -50,7 +50,7 @@ private:
 
 public:
        LogicSignal(boost::shared_ptr<pv::DevInst> dev_inst,
-               sr_probe *const probe,
+               const sr_probe *const probe,
                boost::shared_ptr<pv::data::Logic> data);
 
        virtual ~LogicSignal();
index f054eb2a6a2546f57eacef1025f1a0d54079bf77..61f79a8c8351e8574ceabf779324f8d733195a96 100644 (file)
@@ -32,6 +32,8 @@
 #include "signal.h"
 #include "view.h"
 
+#include <pv/devinst.h>
+
 using boost::shared_ptr;
 
 namespace pv {
@@ -55,7 +57,7 @@ const char *const ProbeNames[] = {
 };
 
 Signal::Signal(shared_ptr<pv::DevInst> dev_inst,
-       sr_probe *const probe) :
+       const sr_probe *const probe) :
        Trace(probe->name),
        _dev_inst(dev_inst),
        _probe(probe),
@@ -80,7 +82,7 @@ bool Signal::enabled() const
 
 void Signal::enable(bool enable)
 {
-       _probe->enabled = enable;
+       _dev_inst->enable_probe(_probe, enable);
        visibility_changed();
 }
 
index a8642d244240f501fc39632318218d319f9047eb..25b671f4217af8e71b0b5a8314849ae31bf79a9a 100644 (file)
@@ -47,7 +47,8 @@ class Signal : public Trace
        Q_OBJECT
 
 protected:
-       Signal(boost::shared_ptr<pv::DevInst> dev_inst, sr_probe *const probe);
+       Signal(boost::shared_ptr<pv::DevInst> dev_inst,
+               const sr_probe *const probe);
 
 public:
        /**
@@ -77,7 +78,7 @@ private slots:
 
 protected:
        boost::shared_ptr<pv::DevInst> _dev_inst;
-       sr_probe *const _probe;
+       const sr_probe *const _probe;
 
        QComboBox *_name_widget;
        bool _updating_name_widget;