projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test/CMakeLists.txt: Drop obsolete boost-thread references.
[pulseview.git]
/
pv
/
device
/
device.cpp
diff --git
a/pv/device/device.cpp
b/pv/device/device.cpp
index be25b5cb1cd017abb7ae0dd46f55650aeeb31878..c6fc5bbe2fa037d0e221cabe3449302d0ccf38b9 100644
(file)
--- a/
pv/device/device.cpp
+++ b/
pv/device/device.cpp
@@
-18,6
+18,7
@@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <cassert>
#include <sstream>
#include <libsigrok/libsigrok.h>
#include <sstream>
#include <libsigrok/libsigrok.h>
@@
-41,6
+42,28
@@
sr_dev_inst* Device::dev_inst() const
return _sdi;
}
return _sdi;
}
+void Device::use(SigSession *owner) throw(QString)
+{
+ DevInst::use(owner);
+
+ sr_session_new();
+
+ assert(_sdi);
+ sr_dev_open(_sdi);
+ if (sr_session_dev_add(_sdi) != SR_OK)
+ throw QString(tr("Failed to use device."));
+}
+
+void Device::release()
+{
+ if (_owner) {
+ DevInst::release();
+ sr_session_destroy();
+ }
+
+ sr_dev_close(_sdi);
+}
+
std::string Device::format_device_title() const
{
ostringstream s;
std::string Device::format_device_title() const
{
ostringstream s;