_shown = show;
}
-const map<const srd_probe*, shared_ptr<view::LogicSignal> >&
-Decoder::probes() const
+const map<const srd_channel*, shared_ptr<view::LogicSignal> >&
+Decoder::channels() const
{
return _probes;
}
-void Decoder::set_probes(std::map<const srd_probe*,
+void Decoder::set_probes(std::map<const srd_channel*,
boost::shared_ptr<view::LogicSignal> > probes)
{
_probes = probes;
bool Decoder::have_required_probes() const
{
- for (GSList *p = _decoder->probes; p; p = p->next) {
- const srd_probe *const probe = (const srd_probe*)p->data;
- assert(probe);
- if (_probes.find(probe) == _probes.end())
+ for (GSList *l = _decoder->channels; l; l = l->next) {
+ const srd_channel *const pdch = (const srd_channel*)l->data;
+ assert(pdch);
+ if (_probes.find(pdch) == _probes.end())
return false;
}
set< shared_ptr<pv::data::Logic> > Decoder::get_data()
{
set< shared_ptr<pv::data::Logic> > data;
- for(map<const srd_probe*, shared_ptr<view::LogicSignal> >::
+ for(map<const srd_channel*, shared_ptr<view::LogicSignal> >::
const_iterator i = _probes.begin();
i != _probes.end(); i++)
{
GHashTable *const probes = g_hash_table_new_full(g_str_hash,
g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
- for(map<const srd_probe*, shared_ptr<view::LogicSignal> >::
+ for(map<const srd_channel*, shared_ptr<view::LogicSignal> >::
const_iterator i = _probes.begin();
i != _probes.end(); i++)
{
g_hash_table_insert(probes, (*i).first->id, gvar);
}
- srd_inst_probe_set_all(decoder_inst, probes, unit_size);
+ srd_inst_channel_set_all(decoder_inst, probes, unit_size);
return decoder_inst;
}
struct srd_decoder;
struct srd_decoder_inst;
-struct srd_probe;
+struct srd_channel;
struct srd_session;
namespace pv {
bool shown() const;
void show(bool show = true);
- const std::map<const srd_probe*,
- boost::shared_ptr<view::LogicSignal> >& probes() const;
- void set_probes(std::map<const srd_probe*,
+ const std::map<const srd_channel*,
+ boost::shared_ptr<view::LogicSignal> >& channels() const;
+ void set_probes(std::map<const srd_channel*,
boost::shared_ptr<view::LogicSignal> > probes);
const std::map<std::string, GVariant*>& options() const;
bool _shown;
- std::map<const srd_probe*, boost::shared_ptr<pv::view::LogicSignal> >
+ std::map<const srd_channel*, boost::shared_ptr<pv::view::LogicSignal> >
_probes;
std::map<std::string, GVariant*> _options;
};
clear();
- // Check that all decoders have the required probes
+ // Check that all decoders have the required channels
BOOST_FOREACH(const shared_ptr<decode::Decoder> &dec, _stack)
if (!dec->have_required_probes()) {
- _error_message = tr("One or more required probes "
+ _error_message = tr("One or more required channels "
"have not been specified");
return;
}
}
}
- // We get the logic data of the first probe in the list.
+ // We get the logic data of the first channel in the list.
// This works because we are currently assuming all
// LogicSignals have the same data/snapshot
BOOST_FOREACH (const shared_ptr<decode::Decoder> &dec, _stack)
- if (dec && !dec->probes().empty() &&
- ((logic_signal = (*dec->probes().begin()).second)) &&
+ if (dec && !dec->channels().empty() &&
+ ((logic_signal = (*dec->channels().begin()).second)) &&
((data = logic_signal->logic_data())))
break;
struct srd_decoder;
struct srd_decoder_annotation_row;
-struct srd_probe;
+struct srd_channel;
struct srd_proto_data;
struct srd_session;
QString text = QString::fromUtf8(title.c_str());
if (sdi->channels) {
- text += QString(" with %1 probes").arg(
+ text += QString(" with %1 channels").arg(
g_slist_length(sdi->channels));
}
#ifdef ENABLE_DECODE
bool SigSession::add_decoder(srd_decoder *const dec)
{
- map<const srd_probe*, shared_ptr<view::LogicSignal> > probes;
+ map<const srd_channel*, shared_ptr<view::LogicSignal> > probes;
shared_ptr<data::DecoderStack> decoder_stack;
try
new data::DecoderStack(*this, dec));
// Make a list of all the probes
- std::vector<const srd_probe*> all_probes;
- for(const GSList *i = dec->probes; i; i = i->next)
- all_probes.push_back((const srd_probe*)i->data);
- for(const GSList *i = dec->opt_probes; i; i = i->next)
- all_probes.push_back((const srd_probe*)i->data);
+ std::vector<const srd_channel*> all_probes;
+ for(const GSList *i = dec->channels; i; i = i->next)
+ all_probes.push_back((const srd_channel*)i->data);
+ for(const GSList *i = dec->opt_channels; i; i = i->next)
+ all_probes.push_back((const srd_channel*)i->data);
// Auto select the initial probes
- BOOST_FOREACH(const srd_probe *probe, all_probes)
+ BOOST_FOREACH(const srd_channel *pdch, all_probes)
BOOST_FOREACH(shared_ptr<view::Signal> s, _signals)
{
shared_ptr<view::LogicSignal> l =
dynamic_pointer_cast<view::LogicSignal>(s);
- if (l && QString::fromUtf8(probe->name).
+ if (l && QString::fromUtf8(pdch->name).
toLower().contains(
l->get_name().toLower()))
- probes[probe] = l;
+ probes[pdch] = l;
}
assert(decoder_stack);
#include <libsigrok/libsigrok.h>
struct srd_decoder;
-struct srd_probe;
+struct srd_channel;
namespace pv {
}
form->addRow(new QLabel(
- tr("<i>* Required Probes</i>"), parent));
+ tr("<i>* Required channels</i>"), parent));
}
// Add stacking button
// This works because we are currently assuming all
// LogicSignals have the same data/snapshot
BOOST_FOREACH (const shared_ptr<Decoder> &dec, stack)
- if (dec && !dec->probes().empty() &&
- ((logic_signal = (*dec->probes().begin()).second)) &&
+ if (dec && !dec->channels().empty() &&
+ ((logic_signal = (*dec->channels().begin()).second)) &&
((data = logic_signal->logic_data())))
break;
shared_ptr<data::decode::Decoder> &dec, QWidget *parent,
QFormLayout *form)
{
- const GSList *probe;
+ const GSList *l;
assert(dec);
const srd_decoder *const decoder = dec->decoder();
QFormLayout *const decoder_form = new QFormLayout;
group->add_layout(decoder_form);
- // Add the mandatory probes
- for(probe = decoder->probes; probe; probe = probe->next) {
- const struct srd_probe *const p =
- (struct srd_probe *)probe->data;
- QComboBox *const combo = create_probe_selector(parent, dec, p);
+ // Add the mandatory channels
+ for(l = decoder->channels; l; l = l->next) {
+ const struct srd_channel *const pdch =
+ (struct srd_channel *)l->data;
+ QComboBox *const combo = create_probe_selector(parent, dec, pdch);
connect(combo, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_probe_selected(int)));
decoder_form->addRow(tr("<b>%1</b> (%2) *")
- .arg(QString::fromUtf8(p->name))
- .arg(QString::fromUtf8(p->desc)), combo);
+ .arg(QString::fromUtf8(pdch->name))
+ .arg(QString::fromUtf8(pdch->desc)), combo);
- const ProbeSelector s = {combo, dec, p};
+ const ProbeSelector s = {combo, dec, pdch};
_probe_selectors.push_back(s);
}
- // Add the optional probes
- for(probe = decoder->opt_probes; probe; probe = probe->next) {
- const struct srd_probe *const p =
- (struct srd_probe *)probe->data;
- QComboBox *const combo = create_probe_selector(parent, dec, p);
+ // Add the optional channels
+ for(l = decoder->opt_channels; l; l = l->next) {
+ const struct srd_channel *const pdch =
+ (struct srd_channel *)l->data;
+ QComboBox *const combo = create_probe_selector(parent, dec, pdch);
connect(combo, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_probe_selected(int)));
decoder_form->addRow(tr("<b>%1</b> (%2)")
- .arg(QString::fromUtf8(p->name))
- .arg(QString::fromUtf8(p->desc)), combo);
+ .arg(QString::fromUtf8(pdch->name))
+ .arg(QString::fromUtf8(pdch->desc)), combo);
- const ProbeSelector s = {combo, dec, p};
+ const ProbeSelector s = {combo, dec, pdch};
_probe_selectors.push_back(s);
}
QComboBox* DecodeTrace::create_probe_selector(
QWidget *parent, const shared_ptr<data::decode::Decoder> &dec,
- const srd_probe *const probe)
+ const srd_channel *const pdch)
{
assert(dec);
const vector< shared_ptr<Signal> > sigs = _session.get_signals();
assert(_decoder_stack);
- const map<const srd_probe*,
+ const map<const srd_channel*,
shared_ptr<LogicSignal> >::const_iterator probe_iter =
- dec->probes().find(probe);
+ dec->channels().find(pdch);
QComboBox *selector = new QComboBox(parent);
selector->addItem("-", qVariantFromValue((void*)NULL));
- if (probe_iter == dec->probes().end())
+ if (probe_iter == dec->channels().end())
selector->setCurrentIndex(0);
for(size_t i = 0; i < sigs.size(); i++) {
{
assert(dec);
- map<const srd_probe*, shared_ptr<LogicSignal> > probe_map;
+ map<const srd_channel*, shared_ptr<LogicSignal> > probe_map;
const vector< shared_ptr<Signal> > sigs = _session.get_signals();
BOOST_FOREACH(const ProbeSelector &s, _probe_selectors)
BOOST_FOREACH(shared_ptr<Signal> sig, sigs)
if(sig.get() == selection) {
- probe_map[s._probe] =
+ probe_map[s._pdch] =
dynamic_pointer_cast<LogicSignal>(sig);
break;
}
#include <pv/prop/binding/decoderoptions.h>
-struct srd_probe;
+struct srd_channel;
struct srd_decoder;
class QComboBox;
{
const QComboBox *_combo;
const boost::shared_ptr<pv::data::decode::Decoder> _decoder;
- const srd_probe *_probe;
+ const srd_channel *_pdch;
};
private:
QComboBox* create_probe_selector(QWidget *parent,
const boost::shared_ptr<pv::data::decode::Decoder> &dec,
- const srd_probe *const probe);
+ const srd_channel *const pdch);
void commit_decoder_probes(
boost::shared_ptr<data::decode::Decoder> &dec);
const srd_decoder *const d = (srd_decoder*)l->data;
assert(d);
- const bool have_probes = (d->probes || d->opt_probes) != 0;
+ const bool have_probes = (d->channels || d->opt_channels) != 0;
if (first_level_decoder == have_probes) {
QAction *const action =
addAction(QString::fromUtf8(d->name));