projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Made the sdi a persisent property of SigSession
[pulseview.git]
/
pv
/
sigsession.cpp
diff --git
a/pv/sigsession.cpp
b/pv/sigsession.cpp
index e22b75a642bfbe635d85f21bcf8275a7073413f8..131f057de5d881e72d442418dff4952ebef74a27 100644
(file)
--- a/
pv/sigsession.cpp
+++ b/
pv/sigsession.cpp
@@
-40,6
+40,7
@@
namespace pv {
SigSession* SigSession::_session = NULL;
SigSession::SigSession() :
SigSession* SigSession::_session = NULL;
SigSession::SigSession() :
+ _sdi(NULL),
_capture_state(Stopped)
{
// TODO: This should not be necessary
_capture_state(Stopped)
{
// TODO: This should not be necessary
@@
-58,6
+59,16
@@
SigSession::~SigSession()
_session = NULL;
}
_session = NULL;
}
+struct sr_dev_inst* SigSession::get_device() const
+{
+ return _sdi;
+}
+
+void SigSession::set_device(struct sr_dev_inst *sdi)
+{
+ _sdi = sdi;
+}
+
void SigSession::load_file(const string &name,
function<void (const QString)> error_handler)
{
void SigSession::load_file(const string &name,
function<void (const QString)> error_handler)
{
@@
-73,15
+84,20
@@
SigSession::capture_state SigSession::get_capture_state() const
return _capture_state;
}
return _capture_state;
}
-void SigSession::start_capture(struct sr_dev_inst *sdi,
- uint64_t record_length,
+void SigSession::start_capture(uint64_t record_length,
function<void (const QString)> error_handler)
{
stop_capture();
function<void (const QString)> error_handler)
{
stop_capture();
+ // Check that a device instance has been selected.
+ if (!_sdi) {
+ qDebug() << "No device selected";
+ return;
+ }
+
// Check that at least one probe is enabled
const GSList *l;
// Check that at least one probe is enabled
const GSList *l;
- for (l = sdi->probes; l; l = l->next) {
+ for (l =
_
sdi->probes; l; l = l->next) {
sr_probe *const probe = (sr_probe*)l->data;
assert(probe);
if (probe->enabled)
sr_probe *const probe = (sr_probe*)l->data;
assert(probe);
if (probe->enabled)
@@
-95,7
+111,7
@@
void SigSession::start_capture(struct sr_dev_inst *sdi,
// Begin the session
_sampling_thread.reset(new boost::thread(
// Begin the session
_sampling_thread.reset(new boost::thread(
- &SigSession::sample_thread_proc, this, sdi,
+ &SigSession::sample_thread_proc, this,
_
sdi,
record_length, error_handler));
}
record_length, error_handler));
}