* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <libsigrokdecode/libsigrokdecode.h>
+
#include "sigsession.h"
#include "devicemanager.h"
#include <stdexcept>
+#include <boost/foreach.hpp>
+
#include <sys/stat.h>
#include <QDebug>
return _logic_data;
}
-bool SigSession::add_decoder(srd_decoder *const dec,
- std::map<const srd_probe*,
- boost::shared_ptr<view::LogicSignal> > probes,
- GHashTable *options)
+bool SigSession::add_decoder(srd_decoder *const dec)
{
+ map<const srd_probe*, shared_ptr<view::LogicSignal> > probes;
+
try
{
lock_guard<mutex> lock(_signals_mutex);
- shared_ptr<data::Decoder> decoder(
- new data::Decoder(dec, probes, options));
+ // Create the decoder
+ shared_ptr<data::Decoder> 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<view::Signal> s, _signals)
+ {
+ shared_ptr<view::LogicSignal> l =
+ dynamic_pointer_cast<view::LogicSignal>(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<view::DecodeSignal> d(
new view::DecodeSignal(*this, decoder,
_decode_traces.size()));
// 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;
}
// 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."));