From: Uwe Hermann Date: Mon, 24 Mar 2014 21:49:57 +0000 (+0100) Subject: Update for 'probe' -> 'channel' rename in libsigrok. X-Git-Tag: pulseview-0.2.0~9 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4871ed92f2d9e6e514223383ba16e6ad78c81161;p=pulseview.git Update for 'probe' -> 'channel' rename in libsigrok. This is an update related to bug #259. --- diff --git a/pv/device/device.cpp b/pv/device/device.cpp index e70be025..4f9a7799 100644 --- a/pv/device/device.cpp +++ b/pv/device/device.cpp @@ -91,8 +91,8 @@ std::string Device::format_device_title() const 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; + for (const GSList *l = _sdi->channels; l; l = l->next) { + const sr_channel *const p = (const sr_channel *)l->data; assert(p); if (p->trigger && p->trigger[0] != '\0') return true; diff --git a/pv/device/devinst.cpp b/pv/device/devinst.cpp index f85c6f5e..4543e5c8 100644 --- a/pv/device/devinst.cpp +++ b/pv/device/devinst.cpp @@ -90,14 +90,14 @@ GVariant* DevInst::list_config(const sr_channel_group *group, int key) return data; } -void DevInst::enable_probe(const sr_probe *probe, bool enable) +void DevInst::enable_probe(const sr_channel *probe, bool enable) { assert(_owner); sr_dev_inst *const sdi = dev_inst(); assert(sdi); - for (const GSList *p = sdi->probes; p; p = p->next) + for (const GSList *p = sdi->channels; p; p = p->next) if (probe == p->data) { - const_cast(probe)->enabled = enable; + const_cast(probe)->enabled = enable; config_changed(); return; } diff --git a/pv/device/devinst.h b/pv/device/devinst.h index bdadc2c3..e6a51409 100644 --- a/pv/device/devinst.h +++ b/pv/device/devinst.h @@ -32,7 +32,7 @@ #include struct sr_dev_inst; -struct sr_probe; +struct sr_channel; struct sr_channel_group; namespace pv { @@ -65,7 +65,7 @@ public: GVariant* list_config(const sr_channel_group *group, int key); - void enable_probe(const sr_probe *probe, bool enable = true); + void enable_probe(const sr_channel *probe, bool enable = true); /** * @brief Gets the sample limit from the driver. diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index c9e8d82c..611c9cc5 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -184,9 +184,9 @@ void Connect::scan_pressed() const string title = dev_inst->format_device_title(); QString text = QString::fromUtf8(title.c_str()); - if (sdi->probes) { + if (sdi->channels) { text += QString(" with %1 probes").arg( - g_slist_length(sdi->probes)); + g_slist_length(sdi->channels)); } QListWidgetItem *const item = new QListWidgetItem(text, diff --git a/pv/popups/probes.cpp b/pv/popups/probes.cpp index 2e1e5924..ca1a2fb6 100644 --- a/pv/popups/probes.cpp +++ b/pv/popups/probes.cpp @@ -63,7 +63,7 @@ Probes::Probes(SigSession &session, QWidget *parent) : assert(sdi); // Collect a set of signals - map > signal_map; + map > signal_map; const vector< shared_ptr > sigs = _session.get_signals(); BOOST_FOREACH(const shared_ptr &sig, sigs) signal_map[sig->probe()] = sig; @@ -78,12 +78,12 @@ Probes::Probes(SigSession &session, QWidget *parent) : // Make a set of signals, and removed this signals from the // signal map. vector< shared_ptr > group_sigs; - for (const GSList *p = group->probes; p; p = p->next) + for (const GSList *p = group->channels; p; p = p->next) { - const sr_probe *const probe = (const sr_probe*)p->data; + const sr_channel *const probe = (const sr_channel*)p->data; assert(probe); - const map >:: + const map >:: iterator iter = signal_map.find(probe); assert(iter != signal_map.end()); @@ -96,12 +96,12 @@ Probes::Probes(SigSession &session, QWidget *parent) : // Make a vector of the remaining probes vector< shared_ptr > global_sigs; - for (const GSList *p = sdi->probes; p; p = p->next) + for (const GSList *p = sdi->channels; p; p = p->next) { - const sr_probe *const probe = (const sr_probe*)p->data; + const sr_channel *const probe = (const sr_channel*)p->data; assert(probe); - const map >:: + const map >:: const_iterator iter = signal_map.find(probe); if (iter != signal_map.end()) global_sigs.push_back((*iter).second); diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index c152481e..e51acde2 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -177,15 +177,15 @@ void SigSession::start_capture(function error_handler) // Check that at least one probe is enabled const GSList *l; - for (l = _dev_inst->dev_inst()->probes; l; l = l->next) { - sr_probe *const probe = (sr_probe*)l->data; + for (l = _dev_inst->dev_inst()->channels; l; l = l->next) { + sr_channel *const probe = (sr_channel*)l->data; assert(probe); if (probe->enabled) break; } if (!l) { - error_handler(tr("No probes enabled.")); + error_handler(tr("No channels enabled.")); return; } @@ -325,14 +325,14 @@ void SigSession::update_signals(shared_ptr dev_inst) // Detect what data types we will receive if(dev_inst) { assert(dev_inst->dev_inst()); - for (const GSList *l = dev_inst->dev_inst()->probes; + for (const GSList *l = dev_inst->dev_inst()->channels; l; l = l->next) { - const sr_probe *const probe = (const sr_probe *)l->data; + const sr_channel *const probe = (const sr_channel *)l->data; if (!probe->enabled) continue; switch(probe->type) { - case SR_PROBE_LOGIC: + case SR_CHANNEL_LOGIC: logic_probe_count++; break; } @@ -361,20 +361,20 @@ void SigSession::update_signals(shared_ptr dev_inst) break; assert(dev_inst->dev_inst()); - for (const GSList *l = dev_inst->dev_inst()->probes; + for (const GSList *l = dev_inst->dev_inst()->channels; l; l = l->next) { shared_ptr signal; - sr_probe *const probe = (sr_probe *)l->data; + sr_channel *const probe = (sr_channel *)l->data; assert(probe); switch(probe->type) { - case SR_PROBE_LOGIC: + case SR_CHANNEL_LOGIC: signal = shared_ptr( new view::LogicSignal(dev_inst, probe, _logic_data)); break; - case SR_PROBE_ANALOG: + case SR_CHANNEL_ANALOG: { shared_ptr data( new data::Analog()); @@ -399,7 +399,7 @@ void SigSession::update_signals(shared_ptr dev_inst) } shared_ptr SigSession::signal_from_probe( - const sr_probe *probe) const + const sr_channel *probe) const { lock_guard lock(_signals_mutex); BOOST_FOREACH(shared_ptr sig, _signals) { @@ -538,20 +538,20 @@ void SigSession::feed_in_analog(const sr_datafeed_analog &analog) { lock_guard lock(_data_mutex); - const unsigned int probe_count = g_slist_length(analog.probes); + const unsigned int probe_count = g_slist_length(analog.channels); const size_t sample_count = analog.num_samples / probe_count; const float *data = analog.data; bool sweep_beginning = false; - for (GSList *p = analog.probes; p; p = p->next) + for (GSList *p = analog.channels; p; p = p->next) { shared_ptr snapshot; - sr_probe *const probe = (sr_probe*)p->data; + sr_channel *const probe = (sr_channel*)p->data; assert(probe); // Try to get the snapshot of the probe - const map< const sr_probe*, shared_ptr >:: + const map< const sr_channel*, shared_ptr >:: iterator iter = _cur_analog_snapshots.find(probe); if (iter != _cur_analog_snapshots.end()) snapshot = (*iter).second; diff --git a/pv/sigsession.h b/pv/sigsession.h index 5953902d..a5f2aa72 100644 --- a/pv/sigsession.h +++ b/pv/sigsession.h @@ -117,7 +117,7 @@ private: void update_signals(boost::shared_ptr dev_inst); boost::shared_ptr signal_from_probe( - const sr_probe *probe) const; + const sr_channel *probe) const; void read_sample_rate(const sr_dev_inst *const sdi); @@ -176,7 +176,7 @@ private: mutable boost::mutex _data_mutex; boost::shared_ptr _logic_data; boost::shared_ptr _cur_logic_snapshot; - std::map< const sr_probe*, boost::shared_ptr > + std::map< const sr_channel*, boost::shared_ptr > _cur_analog_snapshots; boost::thread _sampling_thread; diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index 182e9abd..c3f27383 100644 --- a/pv/view/analogsignal.cpp +++ b/pv/view/analogsignal.cpp @@ -45,7 +45,7 @@ const QColor AnalogSignal::SignalColours[4] = { const float AnalogSignal::EnvelopeThreshold = 256.0f; AnalogSignal::AnalogSignal(shared_ptr dev_inst, - const sr_probe *const probe, shared_ptr data) : + const sr_channel *const probe, shared_ptr data) : Signal(dev_inst, probe), _data(data), _scale(1.0f) diff --git a/pv/view/analogsignal.h b/pv/view/analogsignal.h index 8101167d..f22d128b 100644 --- a/pv/view/analogsignal.h +++ b/pv/view/analogsignal.h @@ -43,7 +43,7 @@ private: public: AnalogSignal(boost::shared_ptr dev_inst, - const sr_probe *const probe, + const sr_channel *const probe, boost::shared_ptr data); virtual ~AnalogSignal(); diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index 52cf4ac1..0b442647 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -64,7 +64,7 @@ const QColor LogicSignal::SignalColours[10] = { }; LogicSignal::LogicSignal(shared_ptr dev_inst, - const sr_probe *const probe, shared_ptr data) : + const sr_channel *const probe, shared_ptr data) : Signal(dev_inst, probe), _data(data), _trigger_none(NULL), @@ -306,7 +306,7 @@ void LogicSignal::set_trigger(char type) const sr_dev_inst *const sdi = _dev_inst->dev_inst(); assert(sdi); - const int probe_count = g_slist_length(sdi->probes); + const int probe_count = g_slist_length(sdi->channels); assert(probe_count > 0); assert(_probe && _probe->index < probe_count); diff --git a/pv/view/logicsignal.h b/pv/view/logicsignal.h index 9b786574..c3e16661 100644 --- a/pv/view/logicsignal.h +++ b/pv/view/logicsignal.h @@ -50,7 +50,7 @@ private: public: LogicSignal(boost::shared_ptr dev_inst, - const sr_probe *const probe, + const sr_channel *const probe, boost::shared_ptr data); virtual ~LogicSignal(); diff --git a/pv/view/signal.cpp b/pv/view/signal.cpp index aadaed78..3312c592 100644 --- a/pv/view/signal.cpp +++ b/pv/view/signal.cpp @@ -57,7 +57,7 @@ const char *const ProbeNames[] = { }; Signal::Signal(shared_ptr dev_inst, - const sr_probe *const probe) : + const sr_channel *const probe) : Trace(probe->name), _dev_inst(dev_inst), _probe(probe), @@ -86,7 +86,7 @@ void Signal::enable(bool enable) visibility_changed(); } -const sr_probe* Signal::probe() const +const sr_channel* Signal::probe() const { return _probe; } diff --git a/pv/view/signal.h b/pv/view/signal.h index 3123519b..32d18177 100644 --- a/pv/view/signal.h +++ b/pv/view/signal.h @@ -30,7 +30,7 @@ #include "trace.h" -struct sr_probe; +struct sr_channel; namespace pv { @@ -50,7 +50,7 @@ class Signal : public Trace protected: Signal(boost::shared_ptr dev_inst, - const sr_probe *const probe); + const sr_channel *const probe); public: /** @@ -67,7 +67,7 @@ public: void enable(bool enable = true); - const sr_probe* probe() const; + const sr_channel* probe() const; virtual void populate_popup_form(QWidget *parent, QFormLayout *form); @@ -80,7 +80,7 @@ private slots: protected: boost::shared_ptr _dev_inst; - const sr_probe *const _probe; + const sr_channel *const _probe; QComboBox *_name_widget; bool _updating_name_widget;