* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <cassert>
#include <sstream>
#include <libsigrok/libsigrok.h>
return _sdi;
}
+void Device::use(SigSession *owner) throw(QString)
+{
+ DevInst::use(owner);
+
+ sr_session_new(&SigSession::_sr_session);
+
+ assert(_sdi);
+ sr_dev_open(_sdi);
+ if (sr_session_dev_add(SigSession::_sr_session, _sdi) != SR_OK)
+ throw QString(tr("Failed to use device."));
+}
+
+void Device::release()
+{
+ if (_owner) {
+ DevInst::release();
+ sr_session_destroy(SigSession::_sr_session);
+ }
+
+ sr_dev_close(_sdi);
+}
+
std::string Device::format_device_title() const
{
ostringstream s;