projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
INSTALL: Mention missing dependency libboost-filesystem.
[pulseview.git]
/
pv
/
device
/
devinst.cpp
diff --git
a/pv/device/devinst.cpp
b/pv/device/devinst.cpp
index a5f96808e55d14161050b5d3e966ca0e847b3c62..4543e5c81d8dba5cf212918bdb31cfa199e6476d 100644
(file)
--- a/
pv/device/devinst.cpp
+++ b/
pv/device/devinst.cpp
@@
-19,7
+19,6
@@
*/
#include <cassert>
*/
#include <cassert>
-#include <sstream>
#include <QDebug>
#include <QDebug>
@@
-27,78
+26,78
@@
#include "devinst.h"
#include "devinst.h"
-using std::ostringstream;
-using std::string;
+#include <pv/sigsession.h>
namespace pv {
namespace device {
namespace pv {
namespace device {
-DevInst::DevInst(
sr_dev_inst *sdi
) :
- _
sdi(sdi
)
+DevInst::DevInst() :
+ _
owner(NULL
)
{
{
- assert(_sdi);
}
}
-sr_dev_inst* DevInst::dev_inst() const
+void DevInst::use(SigSession *owner) throw(QString)
{
{
- return _sdi;
+ assert(owner);
+ assert(!_owner);
+ _owner = owner;
}
}
-string DevInst::format_device_title() const
+void DevInst::release()
{
{
- ostringstream s;
-
- assert(_sdi);
-
- if (_sdi->vendor && _sdi->vendor[0]) {
- s << _sdi->vendor;
- if ((_sdi->model && _sdi->model[0]) ||
- (_sdi->version && _sdi->version[0]))
- s << ' ';
+ if (_owner) {
+ _owner->release_device(this);
+ _owner = NULL;
}
}
+}
- if (_sdi->model && _sdi->model[0]) {
- s << _sdi->model;
- if (_sdi->version && _sdi->version[0])
- s << ' ';
- }
-
- if (_sdi->version && _sdi->version[0])
- s << _sdi->version;
-
- return s.str();
+SigSession* DevInst::owner() const
+{
+ return _owner;
}
}
-GVariant* DevInst::get_config(const sr_
probe
_group *group, int key)
+GVariant* DevInst::get_config(const sr_
channel
_group *group, int key)
{
GVariant *data = NULL;
{
GVariant *data = NULL;
- if (sr_config_get(_sdi->driver, _sdi, group, key, &data) != SR_OK)
+ assert(_owner);
+ sr_dev_inst *const sdi = dev_inst();
+ assert(sdi);
+ if (sr_config_get(sdi->driver, sdi, group, key, &data) != SR_OK)
return NULL;
return data;
}
return NULL;
return data;
}
-bool DevInst::set_config(const sr_
probe
_group *group, int key, GVariant *data)
+bool DevInst::set_config(const sr_
channel
_group *group, int key, GVariant *data)
{
{
- if(sr_config_set(_sdi, group, key, data) == SR_OK) {
+ assert(_owner);
+ sr_dev_inst *const sdi = dev_inst();
+ assert(sdi);
+ if(sr_config_set(sdi, group, key, data) == SR_OK) {
config_changed();
return true;
}
return false;
}
config_changed();
return true;
}
return false;
}
-GVariant* DevInst::list_config(const sr_
probe
_group *group, int key)
+GVariant* DevInst::list_config(const sr_
channel
_group *group, int key)
{
GVariant *data = NULL;
{
GVariant *data = NULL;
- if (sr_config_list(_sdi->driver, _sdi, group, key, &data) != SR_OK)
+ assert(_owner);
+ sr_dev_inst *const sdi = dev_inst();
+ assert(sdi);
+ if (sr_config_list(sdi->driver, sdi, group, key, &data) != SR_OK)
return NULL;
return data;
}
return NULL;
return data;
}
-void DevInst::enable_probe(const sr_
probe
*probe, bool enable)
+void DevInst::enable_probe(const sr_
channel
*probe, bool enable)
{
{
- for (const GSList *p = _sdi->probes; p; p = p->next)
+ assert(_owner);
+ sr_dev_inst *const sdi = dev_inst();
+ assert(sdi);
+ for (const GSList *p = sdi->channels; p; p = p->next)
if (probe == p->data) {
if (probe == p->data) {
- const_cast<sr_
probe
*>(probe)->enabled = enable;
+ const_cast<sr_
channel
*>(probe)->enabled = enable;
config_changed();
return;
}
config_changed();
return;
}
@@
-120,5
+119,21
@@
uint64_t DevInst::get_sample_limit()
return sample_limit;
}
return sample_limit;
}
+bool DevInst::is_trigger_enabled() const
+{
+ return false;
+}
+
+void DevInst::start()
+{
+ if (sr_session_start() != SR_OK)
+ throw tr("Failed to start session.");
+}
+
+void DevInst::run()
+{
+ sr_session_run();
+}
+
} // device
} // pv
} // device
} // pv