projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
4d3c4e3
)
Modified Decode to only use LogicSignals
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Sun, 20 Oct 2013 10:15:53 +0000
(11:15 +0100)
committer
Joel Holdsworth
<joel@airwebreathe.org.uk>
Wed, 23 Oct 2013 23:12:24 +0000
(
00:12
+0100)
pv/data/decoder.cpp
patch
|
blob
|
history
pv/data/decoder.h
patch
|
blob
|
history
pv/dialogs/decoder.cpp
patch
|
blob
|
history
pv/dialogs/decoder.h
patch
|
blob
|
history
pv/mainwindow.cpp
patch
|
blob
|
history
pv/sigsession.cpp
patch
|
blob
|
history
pv/sigsession.h
patch
|
blob
|
history
test/data/decoder.cpp
patch
|
blob
|
history
diff --git
a/pv/data/decoder.cpp
b/pv/data/decoder.cpp
index d8a538cbec9368ddffde92d474e2478d9027adbc..923140397ef528d02b9bb2ea84f2849f2d8573d0 100644
(file)
--- a/
pv/data/decoder.cpp
+++ b/
pv/data/decoder.cpp
@@
-45,7
+45,7
@@
const int64_t Decoder::DecodeChunkLength = 4096;
Decoder::Decoder(const srd_decoder *const dec,
std::map<const srd_probe*,
Decoder::Decoder(const srd_decoder *const dec,
std::map<const srd_probe*,
- boost::shared_ptr<pv::view::Signal> > probes,
+ boost::shared_ptr<pv::view::
Logic
Signal> > probes,
GHashTable *options) :
_decoder(dec),
_probes(probes),
GHashTable *options) :
_decoder(dec),
_probes(probes),
@@
-93,12
+93,9
@@
void Decoder::begin_decode()
// We get the logic data of the first probe in the list.
// This works because we are currently assuming all
// LogicSignals have the same data/snapshot
// We get the logic data of the first probe in the list.
// This works because we are currently assuming all
// LogicSignals have the same data/snapshot
- shared_ptr<pv::view::Signal> sig = (*_probes.begin()).second;
+ shared_ptr<pv::view::
Logic
Signal> sig = (*_probes.begin()).second;
assert(sig);
assert(sig);
- const pv::view::LogicSignal *const l =
- dynamic_cast<pv::view::LogicSignal*>(sig.get());
- assert(l);
- shared_ptr<data::Logic> data = l->data();
+ shared_ptr<data::Logic> data = sig->data();
_decode_thread = boost::thread(&Decoder::decode_proc, this,
data);
_decode_thread = boost::thread(&Decoder::decode_proc, this,
data);
@@
-139,7
+136,7
@@
bool Decoder::init_decoder()
GHashTable *probes = g_hash_table_new_full(g_str_hash,
g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
GHashTable *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::Signal> >::
+ for(map<const srd_probe*, shared_ptr<view::
Logic
Signal> >::
const_iterator i = _probes.begin();
i != _probes.end(); i++)
{
const_iterator i = _probes.begin();
i != _probes.end(); i++)
{
diff --git
a/pv/data/decoder.h
b/pv/data/decoder.h
index 264920a723422c9bf51f5e1fb6947e9f5e03f759..cdeb7e7a59adc0a449937a7df5ec51a02d73f601 100644
(file)
--- a/
pv/data/decoder.h
+++ b/
pv/data/decoder.h
@@
-41,7
+41,7
@@
struct srd_session;
namespace pv {
namespace view {
namespace pv {
namespace view {
-class Signal;
+class
Logic
Signal;
namespace decode {
class Annotation;
namespace decode {
class Annotation;
@@
-65,7
+65,7
@@
private:
public:
Decoder(const srd_decoder *const decoder,
std::map<const srd_probe*,
public:
Decoder(const srd_decoder *const decoder,
std::map<const srd_probe*,
- boost::shared_ptr<pv::view::Signal> > probes,
+ boost::shared_ptr<pv::view::
Logic
Signal> > probes,
GHashTable *options);
virtual ~Decoder();
GHashTable *options);
virtual ~Decoder();
@@
-92,7
+92,7
@@
signals:
private:
const srd_decoder *const _decoder;
private:
const srd_decoder *const _decoder;
- std::map<const srd_probe*, boost::shared_ptr<view::Signal> >
+ std::map<const srd_probe*, boost::shared_ptr<view::
Logic
Signal> >
_probes;
GHashTable *_options;
_probes;
GHashTable *_options;
diff --git
a/pv/dialogs/decoder.cpp
b/pv/dialogs/decoder.cpp
index 88ccf76021f9acc7b7888695257cacc6f673c684..07375f649b35a883efa8b65991f5f1d300d8a88c 100644
(file)
--- a/
pv/dialogs/decoder.cpp
+++ b/
pv/dialogs/decoder.cpp
@@
-40,7
+40,8
@@
namespace pv {
namespace dialogs {
Decoder::Decoder(QWidget *parent, const srd_decoder *decoder,
namespace dialogs {
Decoder::Decoder(QWidget *parent, const srd_decoder *decoder,
- const vector< shared_ptr<view::Signal> > &sigs, GHashTable *options) :
+ const vector< shared_ptr<view::LogicSignal> > &sigs,
+ GHashTable *options) :
QDialog(parent),
_sigs(sigs),
_binding(decoder, options),
QDialog(parent),
_sigs(sigs),
_binding(decoder, options),
@@
-121,10
+122,11
@@
QComboBox* Decoder::create_probe_selector(
selector->setCurrentIndex(0);
for(size_t i = 0; i < _sigs.size(); i++) {
selector->setCurrentIndex(0);
for(size_t i = 0; i < _sigs.size(); i++) {
- const shared_ptr<view::Signal> s(_sigs[i]);
+ const shared_ptr<view::
Logic
Signal> s(_sigs[i]);
assert(s);
assert(s);
- if (s->enabled()) {
+ if (s->enabled())
+ {
selector->addItem(s->get_name(), qVariantFromValue(i));
if(s->get_name().toLower().contains(
QString(name).toLower()))
selector->addItem(s->get_name(), qVariantFromValue(i));
if(s->get_name().toLower().contains(
QString(name).toLower()))
@@
-135,9
+137,9
@@
QComboBox* Decoder::create_probe_selector(
return selector;
}
return selector;
}
-map<const srd_probe*, shared_ptr<view::Signal> > Decoder::get_probes()
+map<const srd_probe*, shared_ptr<view::
Logic
Signal> > Decoder::get_probes()
{
{
- map<const srd_probe*, shared_ptr<view::Signal> > probe_map;
+ map<const srd_probe*, shared_ptr<view::
Logic
Signal> > probe_map;
for(map<const srd_probe*, QComboBox*>::const_iterator i =
_probe_selector_map.begin();
i != _probe_selector_map.end(); i++)
for(map<const srd_probe*, QComboBox*>::const_iterator i =
_probe_selector_map.begin();
i != _probe_selector_map.end(); i++)
@@
-146,12
+148,8
@@
map<const srd_probe*, shared_ptr<view::Signal> > Decoder::get_probes()
const int probe_index =
combo->itemData(combo->currentIndex()).value<int>();
if(probe_index >= 0) {
const int probe_index =
combo->itemData(combo->currentIndex()).value<int>();
if(probe_index >= 0) {
- shared_ptr<view::Signal> sig = _sigs[probe_index];
- if(dynamic_cast<pv::view::LogicSignal*>(sig.get()))
- probe_map[(*i).first] = sig;
- else
- qDebug() << "Currently only logic signals "
- "are supported for decoding";
+ shared_ptr<view::LogicSignal> sig = _sigs[probe_index];
+ probe_map[(*i).first] = sig;
}
}
}
}
diff --git
a/pv/dialogs/decoder.h
b/pv/dialogs/decoder.h
index 56f02aa4480bf627d52d66883ed6cfc2ae8940ec..926d015b6a6f953448339a7d0f7d6556d7083518 100644
(file)
--- a/
pv/dialogs/decoder.h
+++ b/
pv/dialogs/decoder.h
@@
-40,7
+40,7
@@
struct srd_decoder;
namespace pv {
namespace view {
namespace pv {
namespace view {
-class Signal;
+class
Logic
Signal;
}
namespace dialogs {
}
namespace dialogs {
@@
-49,12
+49,12
@@
class Decoder : public QDialog
{
public:
Decoder(QWidget *parent, const srd_decoder *decoder,
{
public:
Decoder(QWidget *parent, const srd_decoder *decoder,
- const std::vector< boost::shared_ptr<view::Signal> > &sigs,
+ const std::vector< boost::shared_ptr<view::
Logic
Signal> > &sigs,
GHashTable *options);
void accept();
GHashTable *options);
void accept();
- std::map<const srd_probe*, boost::shared_ptr<view::Signal> >
+ std::map<const srd_probe*, boost::shared_ptr<view::
Logic
Signal> >
get_probes();
private:
get_probes();
private:
@@
-62,7
+62,7
@@
private:
QWidget *parent, const char *name);
private:
QWidget *parent, const char *name);
private:
- const std::vector< boost::shared_ptr<view::Signal> > &_sigs;
+ const std::vector< boost::shared_ptr<view::
Logic
Signal> > &_sigs;
std::map<const srd_probe*, QComboBox*> _probe_selector_map;
std::map<const srd_probe*, QComboBox*> _probe_selector_map;
diff --git
a/pv/mainwindow.cpp
b/pv/mainwindow.cpp
index f7b8612054ff058997a8cd0f2cd3f75b8310f5a0..183e841e804c3c6f48d37949268ec3227a0c70be 100644
(file)
--- a/
pv/mainwindow.cpp
+++ b/
pv/mainwindow.cpp
@@
-41,6
+41,7
@@
#include "dialogs/connect.h"
#include "dialogs/decoder.h"
#include "toolbars/samplingbar.h"
#include "dialogs/connect.h"
#include "dialogs/decoder.h"
#include "toolbars/samplingbar.h"
+#include "view/logicsignal.h"
#include "view/view.h"
/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
#include "view/view.h"
/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
@@
-375,13
+376,21
@@
void MainWindow::add_decoder(QObject *action)
(srd_decoder*)((QAction*)action)->data().value<void*>();
assert(dec);
(srd_decoder*)((QAction*)action)->data().value<void*>();
assert(dec);
- const std::vector< boost::shared_ptr<view::Signal> > &sigs =
+ vector< shared_ptr<view::LogicSignal> > logic_sigs;
+ const vector< shared_ptr<view::Signal> > &sigs =
_session.get_signals();
_session.get_signals();
+ BOOST_FOREACH(shared_ptr<view::Signal> s, sigs) {
+ assert(s);
+ shared_ptr<view::LogicSignal> l =
+ dynamic_pointer_cast<view::LogicSignal>(s);
+ if (l)
+ logic_sigs.push_back(l);
+ }
GHashTable *const options = g_hash_table_new_full(g_str_hash,
g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
GHashTable *const options = g_hash_table_new_full(g_str_hash,
g_str_equal, g_free, (GDestroyNotify)g_variant_unref);
- dialogs::Decoder dlg(this, dec, sigs, options);
+ dialogs::Decoder dlg(this, dec,
logic_
sigs, options);
if(dlg.exec() != QDialog::Accepted) {
g_hash_table_destroy(options);
return;
if(dlg.exec() != QDialog::Accepted) {
g_hash_table_destroy(options);
return;
diff --git
a/pv/sigsession.cpp
b/pv/sigsession.cpp
index e81d36051fa068e361eafb01c18ef3aeee02caaa..aadaf45011451bc21bad01045f7781347cd1aaaa 100644
(file)
--- a/
pv/sigsession.cpp
+++ b/
pv/sigsession.cpp
@@
-197,7
+197,7
@@
boost::shared_ptr<data::Logic> SigSession::get_data()
bool SigSession::add_decoder(srd_decoder *const dec,
std::map<const srd_probe*,
bool SigSession::add_decoder(srd_decoder *const dec,
std::map<const srd_probe*,
- boost::shared_ptr<view::Signal> > probes,
+ boost::shared_ptr<view::
Logic
Signal> > probes,
GHashTable *options)
{
try
GHashTable *options)
{
try
diff --git
a/pv/sigsession.h
b/pv/sigsession.h
index 499814cadbb4c223294382aa520c19d80bc9a091..5c69a9bc3a1aa428982ce64b15bf240bda08d322 100644
(file)
--- a/
pv/sigsession.h
+++ b/
pv/sigsession.h
@@
-50,6
+50,7
@@
class LogicSnapshot;
namespace view {
class DecodeSignal;
namespace view {
class DecodeSignal;
+class LogicSignal;
class Signal;
}
class Signal;
}
@@
-95,7
+96,7
@@
public:
bool add_decoder(srd_decoder *const dec,
std::map<const srd_probe*,
bool add_decoder(srd_decoder *const dec,
std::map<const srd_probe*,
- boost::shared_ptr<view::Signal> > probes,
+ boost::shared_ptr<view::
Logic
Signal> > probes,
GHashTable *options);
std::vector< boost::shared_ptr<view::DecodeSignal> >
GHashTable *options);
std::vector< boost::shared_ptr<view::DecodeSignal> >
diff --git
a/test/data/decoder.cpp
b/test/data/decoder.cpp
index 4a74c417e0d4ac467dfbc7de2b5ac13448b09aa7..641064da23f56dd8786f40a3c853a54bc9f6f33b 100644
(file)
--- a/
test/data/decoder.cpp
+++ b/
test/data/decoder.cpp
@@
-52,7
+52,7
@@
BOOST_AUTO_TEST_CASE(TwoDecoder)
srd_decoder *const dec = (struct srd_decoder*)l->data;
BOOST_REQUIRE(dec);
srd_decoder *const dec = (struct srd_decoder*)l->data;
BOOST_REQUIRE(dec);
- map<const srd_probe*, shared_ptr<pv::view::Signal> > probes;
+ map<const srd_probe*, shared_ptr<pv::view::
Logic
Signal> > probes;
BOOST_CHECK (ss.add_decoder(dec, probes,
g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
(GDestroyNotify)g_variant_unref)));
BOOST_CHECK (ss.add_decoder(dec, probes,
g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
(GDestroyNotify)g_variant_unref)));