projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pv::DeviceManager now manages opening/closing devices
[pulseview.git]
/
pv
/
sigsession.cpp
diff --git
a/pv/sigsession.cpp
b/pv/sigsession.cpp
index 4fe51dd57131682ae11c31f45eb85f6aee4de461..5ab30ab1299e2e7bb81475053049eb46f189c3e1 100644
(file)
--- a/
pv/sigsession.cpp
+++ b/
pv/sigsession.cpp
@@
-20,6
+20,7
@@
#include "sigsession.h"
#include "sigsession.h"
+#include "devicemanager.h"
#include "data/analog.h"
#include "data/analogsnapshot.h"
#include "data/logic.h"
#include "data/analog.h"
#include "data/analogsnapshot.h"
#include "data/logic.h"
@@
-39,7
+40,8
@@
namespace pv {
// TODO: This should not be necessary
SigSession* SigSession::_session = NULL;
// TODO: This should not be necessary
SigSession* SigSession::_session = NULL;
-SigSession::SigSession() :
+SigSession::SigSession(DeviceManager &device_manager) :
+ _device_manager(device_manager),
_sdi(NULL),
_capture_state(Stopped)
{
_sdi(NULL),
_capture_state(Stopped)
{
@@
-59,15
+61,28
@@
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)
{
if (_sdi)
void SigSession::set_device(struct sr_dev_inst *sdi)
{
if (_sdi)
-
sr_dev_clos
e(_sdi);
+
_device_manager.release_devic
e(_sdi);
if (sdi)
if (sdi)
-
sr_dev_open(sdi
);
+
_device_manager.use_device(sdi, this
);
_sdi = sdi;
}
_sdi = sdi;
}
+void SigSession::release_device(struct sr_dev_inst *sdi)
+{
+ (void)sdi;
+
+ assert(_capture_state == Stopped);
+ _sdi = NULL;
+}
+
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)
{