+#ifdef ENABLE_DECODE
+bool SigSession::add_decoder(srd_decoder *const dec)
+{
+ map<const srd_channel*, shared_ptr<view::LogicSignal> > probes;
+ shared_ptr<data::DecoderStack> decoder_stack;
+
+ try
+ {
+ lock_guard<mutex> lock(_signals_mutex);
+
+ // Create the decoder
+ decoder_stack = shared_ptr<data::DecoderStack>(
+ new data::DecoderStack(*this, dec));
+
+ // Make a list of all the probes
+ 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_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(pdch->name).
+ toLower().contains(
+ l->get_name().toLower()))
+ probes[pdch] = l;
+ }
+
+ assert(decoder_stack);
+ assert(!decoder_stack->stack().empty());
+ assert(decoder_stack->stack().front());
+ decoder_stack->stack().front()->set_probes(probes);
+
+ // Create the decode signal
+ shared_ptr<view::DecodeTrace> d(
+ new view::DecodeTrace(*this, decoder_stack,
+ _decode_traces.size()));
+ _decode_traces.push_back(d);
+ }
+ catch(std::runtime_error e)
+ {
+ return false;
+ }
+
+ signals_changed();
+
+ // Do an initial decode
+ decoder_stack->begin_decode();
+
+ return true;
+}
+
+vector< shared_ptr<view::DecodeTrace> > SigSession::get_decode_signals() const