X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fsigsession.cpp;h=aeb6d22072f55f6bc49c04dd389295fd852b5c6a;hb=4e5a4405482a296ebb6014e627298ad156c78d55;hp=aadaf45011451bc21bad01045f7781347cd1aaaa;hpb=3045c869ada2e32bf55cbb68633b5213b9b11e28;p=pulseview.git diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index aadaf45..aeb6d22 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "sigsession.h" #include "devicemanager.h" @@ -36,6 +38,8 @@ #include +#include + #include #include @@ -195,17 +199,34 @@ boost::shared_ptr SigSession::get_data() return _logic_data; } -bool SigSession::add_decoder(srd_decoder *const dec, - std::map > probes, - GHashTable *options) +bool SigSession::add_decoder(srd_decoder *const dec) { + map > probes; + try { lock_guard lock(_signals_mutex); - shared_ptr decoder( - new data::Decoder(dec, probes, options)); + // Create the decoder + shared_ptr decoder(new data::Decoder(dec)); + + // Auto select the initial probes + for(const GSList *i = dec->probes; i; i = i->next) + { + const srd_probe *const probe = (const srd_probe*)i->data; + BOOST_FOREACH(shared_ptr s, _signals) + { + shared_ptr l = + dynamic_pointer_cast(s); + if (l && QString(probe->name).toLower().contains( + l->get_name().toLower())) + probes[probe] = l; + } + } + + decoder->set_probes(probes); + + // Create the decode signal shared_ptr d( new view::DecodeSignal(*this, decoder, _decode_traces.size())); @@ -428,8 +449,8 @@ void SigSession::read_sample_rate(const sr_dev_inst *const sdi) // Read out the sample rate if(sdi->driver) { - const int ret = sr_config_get(sdi->driver, - SR_CONF_SAMPLERATE, &gvar, sdi); + const int ret = sr_config_get(sdi->driver, sdi, NULL, + SR_CONF_SAMPLERATE, &gvar); if (ret != SR_OK) { qDebug("Failed to get samplerate\n"); return; @@ -505,7 +526,7 @@ void SigSession::sample_thread_proc(struct sr_dev_inst *sdi, } // Set the sample limit - if (sr_config_set(sdi, SR_CONF_LIMIT_SAMPLES, + if (sr_config_set(sdi, NULL, SR_CONF_LIMIT_SAMPLES, g_variant_new_uint64(record_length)) != SR_OK) { error_handler(tr("Failed to configure " "time-based sample limit."));