X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fsigsession.cpp;h=131f057de5d881e72d442418dff4952ebef74a27;hb=d64d159628c795e1413127aafd83ec1bc9ace91c;hp=e22b75a642bfbe635d85f21bcf8275a7073413f8;hpb=174e27a1f67683c608277ae522931579cad30eaf;p=pulseview.git diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index e22b75a..131f057 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -40,6 +40,7 @@ namespace pv { SigSession* SigSession::_session = NULL; SigSession::SigSession() : + _sdi(NULL), _capture_state(Stopped) { // TODO: This should not be necessary @@ -58,6 +59,16 @@ SigSession::~SigSession() _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 error_handler) { @@ -73,15 +84,20 @@ SigSession::capture_state SigSession::get_capture_state() const 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 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; - 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) @@ -95,7 +111,7 @@ void SigSession::start_capture(struct sr_dev_inst *sdi, // 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)); }