set(pulseview_SOURCES
main.cpp
pv/devicemanager.cpp
- pv/devinst.cpp
pv/mainwindow.cpp
pv/sigsession.cpp
pv/storesession.cpp
pv/data/logicsnapshot.cpp
pv/data/signaldata.cpp
pv/data/snapshot.cpp
+ pv/device/devinst.cpp
pv/dialogs/about.cpp
pv/dialogs/connect.cpp
pv/dialogs/storeprogress.cpp
# This list includes only QObject derived class headers.
set(pulseview_HEADERS
- pv/devinst.h
pv/mainwindow.h
pv/sigsession.h
pv/storesession.h
+ pv/device/devinst.h
pv/dialogs/about.h
pv/dialogs/connect.h
pv/dialogs/storeprogress.h
--- /dev/null
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <cassert>
+#include <sstream>
+
+#include <QDebug>
+
+#include <libsigrok/libsigrok.h>
+
+#include "devinst.h"
+
+using std::ostringstream;
+using std::string;
+
+namespace pv {
+namespace device {
+
+DevInst::DevInst(sr_dev_inst *sdi) :
+ _sdi(sdi)
+{
+ assert(_sdi);
+}
+
+sr_dev_inst* DevInst::dev_inst() const
+{
+ return _sdi;
+}
+
+string DevInst::format_device_title() const
+{
+ 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 (_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();
+}
+
+GVariant* DevInst::get_config(const sr_probe_group *group, int key)
+{
+ GVariant *data = NULL;
+ if (sr_config_get(_sdi->driver, _sdi, group, key, &data) != SR_OK)
+ return NULL;
+ return data;
+}
+
+bool DevInst::set_config(const sr_probe_group *group, int key, GVariant *data)
+{
+ if(sr_config_set(_sdi, group, key, data) == SR_OK) {
+ config_changed();
+ return true;
+ }
+ return false;
+}
+
+GVariant* DevInst::list_config(const sr_probe_group *group, int key)
+{
+ GVariant *data = NULL;
+ if (sr_config_list(_sdi->driver, _sdi, group, key, &data) != SR_OK)
+ return NULL;
+ return data;
+}
+
+void DevInst::enable_probe(const sr_probe *probe, bool enable)
+{
+ for (const GSList *p = _sdi->probes; p; p = p->next)
+ if (probe == p->data) {
+ const_cast<sr_probe*>(probe)->enabled = enable;
+ config_changed();
+ return;
+ }
+
+ // Probe was not found in the device
+ assert(0);
+}
+
+uint64_t DevInst::get_sample_limit()
+{
+ uint64_t sample_limit;
+ GVariant* gvar = get_config(NULL, SR_CONF_LIMIT_SAMPLES);
+ if (gvar != NULL) {
+ sample_limit = g_variant_get_uint64(gvar);
+ g_variant_unref(gvar);
+ } else {
+ sample_limit = 0U;
+ }
+ return sample_limit;
+}
+
+} // device
+} // pv
--- /dev/null
+/*
+ * This file is part of the PulseView project.
+ *
+ * Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef PULSEVIEW_PV_DEVICE_DEVINST_H
+#define PULSEVIEW_PV_DEVICE_DEVINST_H
+
+#include <string>
+
+#include <boost/shared_ptr.hpp>
+
+#include <QObject>
+
+#include <glib.h>
+
+#include <stdint.h>
+
+struct sr_dev_inst;
+struct sr_probe;
+struct sr_probe_group;
+
+namespace pv {
+namespace device {
+
+class DevInst : public QObject
+{
+ Q_OBJECT
+
+public:
+ DevInst(sr_dev_inst *sdi);
+
+ sr_dev_inst* dev_inst() const;
+
+ std::string format_device_title() const;
+
+ GVariant* get_config(const sr_probe_group *group, int key);
+
+ bool set_config(const sr_probe_group *group, int key, GVariant *data);
+
+ GVariant* list_config(const sr_probe_group *group, int key);
+
+ void enable_probe(const sr_probe *probe, bool enable = true);
+
+ /**
+ * @brief Gets the sample limit from the driver.
+ *
+ * @return The returned sample limit from the driver, or 0 if the
+ * sample limit could not be read.
+ */
+ uint64_t get_sample_limit();
+
+signals:
+ void config_changed();
+
+private:
+ sr_dev_inst *const _sdi;
+};
+
+} // device
+} // pv
+
+#endif // PULSEVIEW_PV_DEVICE_DEVINST_H
*/
#include "devicemanager.h"
-#include "devinst.h"
+#include "device/devinst.h"
#include "sigsession.h"
#include <cassert>
release_devices();
}
-const list< shared_ptr<pv::DevInst> >& DeviceManager::devices() const
+const list< shared_ptr<pv::device::DevInst> >& DeviceManager::devices() const
{
return _devices;
}
-void DeviceManager::use_device(shared_ptr<DevInst> dev_inst, SigSession *owner)
+void DeviceManager::use_device(shared_ptr<device::DevInst> dev_inst,
+ SigSession *owner)
{
assert(dev_inst);
assert(owner);
sr_dev_open(dev_inst->dev_inst());
}
-void DeviceManager::release_device(shared_ptr<DevInst> dev_inst)
+void DeviceManager::release_device(shared_ptr<device::DevInst> dev_inst)
{
assert(dev_inst);
// Notify the owner, and remove the device from the used device list
- map< shared_ptr<DevInst>, pv::SigSession*>::const_iterator iter =
- _used_devices.find(dev_inst);
+ map< shared_ptr<device::DevInst>, pv::SigSession*>::const_iterator
+ iter = _used_devices.find(dev_inst);
assert(iter != _used_devices.end());
(*iter).second->release_device(dev_inst);
_used_devices.erase(dev_inst);
}
-list< shared_ptr<DevInst> > DeviceManager::driver_scan(
+list< shared_ptr<device::DevInst> > DeviceManager::driver_scan(
struct sr_dev_driver *const driver, GSList *const drvopts)
{
- list< shared_ptr<DevInst> > driver_devices;
+ list< shared_ptr<device::DevInst> > driver_devices;
assert(driver);
// Remove any device instances from this driver from the device
// list. They will not be valid after the scan.
- list< shared_ptr<DevInst> >::iterator i = _devices.begin();
+ list< shared_ptr<device::DevInst> >::iterator i = _devices.begin();
while (i != _devices.end()) {
if ((*i)->dev_inst()->driver == driver)
i = _devices.erase(i);
// Do the scan
GSList *const devices = sr_driver_scan(driver, drvopts);
for (GSList *l = devices; l; l = l->next)
- driver_devices.push_back(shared_ptr<DevInst>(
- new DevInst((sr_dev_inst*)l->data)));
+ driver_devices.push_back(shared_ptr<device::DevInst>(
+ new device::DevInst((sr_dev_inst*)l->data)));
g_slist_free(devices);
driver_devices.sort(compare_devices);
void DeviceManager::release_devices()
{
// Release all the used devices
- for (map<shared_ptr<DevInst>, SigSession*>::iterator i =
+ for (map<shared_ptr<device::DevInst>, SigSession*>::iterator i =
_used_devices.begin(); i != _used_devices.end(); i++)
release_device((*i).first);
void DeviceManager::release_driver(struct sr_dev_driver *const driver)
{
assert(driver);
- for (map<shared_ptr<DevInst>, SigSession*>::iterator i =
+ for (map<shared_ptr<device::DevInst>, SigSession*>::iterator i =
_used_devices.begin(); i != _used_devices.end(); i++)
if((*i).first->dev_inst()->driver == driver)
{
sr_dev_clear(driver);
}
-bool DeviceManager::compare_devices(shared_ptr<DevInst> a,
- shared_ptr<DevInst> b)
+bool DeviceManager::compare_devices(shared_ptr<device::DevInst> a,
+ shared_ptr<device::DevInst> b)
{
assert(a);
assert(b);
namespace pv {
-class DevInst;
class SigSession;
+namespace device {
+class DevInst;
+}
+
class DeviceManager
{
public:
~DeviceManager();
- const std::list< boost::shared_ptr<pv::DevInst> >& devices() const;
+ const std::list< boost::shared_ptr<pv::device::DevInst> >&
+ devices() const;
- void use_device(boost::shared_ptr<pv::DevInst> dev_inst,
+ void use_device(boost::shared_ptr<pv::device::DevInst> dev_inst,
SigSession *owner);
- void release_device(boost::shared_ptr<pv::DevInst> dev_inst);
+ void release_device(boost::shared_ptr<pv::device::DevInst> dev_inst);
- std::list< boost::shared_ptr<DevInst> > driver_scan(
+ std::list< boost::shared_ptr<pv::device::DevInst> > driver_scan(
struct sr_dev_driver *const driver,
GSList *const drvopts = NULL);
void release_driver(struct sr_dev_driver *const driver);
- static bool compare_devices(boost::shared_ptr<DevInst> a,
- boost::shared_ptr<DevInst> b);
+ static bool compare_devices(boost::shared_ptr<device::DevInst> a,
+ boost::shared_ptr<device::DevInst> b);
private:
struct sr_context *const _sr_ctx;
- std::list< boost::shared_ptr<pv::DevInst> > _devices;
- std::map< boost::shared_ptr<pv::DevInst>, pv::SigSession*>
+ std::list< boost::shared_ptr<pv::device::DevInst> > _devices;
+ std::map< boost::shared_ptr<pv::device::DevInst>, pv::SigSession*>
_used_devices;
};
+++ /dev/null
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <cassert>
-#include <sstream>
-
-#include <QDebug>
-
-#include <libsigrok/libsigrok.h>
-
-#include "devinst.h"
-
-using std::ostringstream;
-using std::string;
-
-namespace pv {
-
-DevInst::DevInst(sr_dev_inst *sdi) :
- _sdi(sdi)
-{
- assert(_sdi);
-}
-
-sr_dev_inst* DevInst::dev_inst() const
-{
- return _sdi;
-}
-
-string DevInst::format_device_title() const
-{
- 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 (_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();
-}
-
-GVariant* DevInst::get_config(const sr_probe_group *group, int key)
-{
- GVariant *data = NULL;
- if (sr_config_get(_sdi->driver, _sdi, group, key, &data) != SR_OK)
- return NULL;
- return data;
-}
-
-bool DevInst::set_config(const sr_probe_group *group, int key, GVariant *data)
-{
- if(sr_config_set(_sdi, group, key, data) == SR_OK) {
- config_changed();
- return true;
- }
- return false;
-}
-
-GVariant* DevInst::list_config(const sr_probe_group *group, int key)
-{
- GVariant *data = NULL;
- if (sr_config_list(_sdi->driver, _sdi, group, key, &data) != SR_OK)
- return NULL;
- return data;
-}
-
-void DevInst::enable_probe(const sr_probe *probe, bool enable)
-{
- for (const GSList *p = _sdi->probes; p; p = p->next)
- if (probe == p->data) {
- const_cast<sr_probe*>(probe)->enabled = enable;
- config_changed();
- return;
- }
-
- // Probe was not found in the device
- assert(0);
-}
-
-uint64_t DevInst::get_sample_limit()
-{
- uint64_t sample_limit;
- GVariant* gvar = get_config(NULL, SR_CONF_LIMIT_SAMPLES);
- if (gvar != NULL) {
- sample_limit = g_variant_get_uint64(gvar);
- g_variant_unref(gvar);
- } else {
- sample_limit = 0U;
- }
- return sample_limit;
-}
-
-} // pv
+++ /dev/null
-/*
- * This file is part of the PulseView project.
- *
- * Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef PULSEVIEW_PV_DEVINST_H
-#define PULSEVIEW_PV_DEVINST_H
-
-#include <string>
-
-#include <boost/shared_ptr.hpp>
-
-#include <QObject>
-
-#include <glib.h>
-
-#include <stdint.h>
-
-struct sr_dev_inst;
-struct sr_probe;
-struct sr_probe_group;
-
-namespace pv {
-
-class DevInst : public QObject
-{
- Q_OBJECT
-
-public:
- DevInst(sr_dev_inst *sdi);
-
- sr_dev_inst* dev_inst() const;
-
- std::string format_device_title() const;
-
- GVariant* get_config(const sr_probe_group *group, int key);
-
- bool set_config(const sr_probe_group *group, int key, GVariant *data);
-
- GVariant* list_config(const sr_probe_group *group, int key);
-
- void enable_probe(const sr_probe *probe, bool enable = true);
-
- /**
- * @brief Gets the sample limit from the driver.
- *
- * @return The returned sample limit from the driver, or 0 if the
- * sample limit could not be read.
- */
- uint64_t get_sample_limit();
-
-signals:
- void config_changed();
-
-private:
- sr_dev_inst *const _sdi;
-};
-
-} // pv
-
-#endif // PULSEVIEW_PV_DEVINST_H
#include "connect.h"
#include "pv/devicemanager.h"
-#include "pv/devinst.h"
+#include "pv/device/devinst.h"
extern "C" {
/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */
_layout.addWidget(&_button_box);
}
-shared_ptr<DevInst> Connect::get_selected_device() const
+shared_ptr<device::DevInst> Connect::get_selected_device() const
{
const QListWidgetItem *const item = _device_list.currentItem();
if (!item)
- return shared_ptr<DevInst>();
+ return shared_ptr<device::DevInst>();
const sr_dev_inst *const sdi = (sr_dev_inst*)item->data(
Qt::UserRole).value<void*>();
assert(sdi);
- std::map<const sr_dev_inst*, boost::shared_ptr<pv::DevInst> >::
+ std::map<const sr_dev_inst*, boost::shared_ptr<pv::device::DevInst> >::
const_iterator iter = _device_map.find(sdi);
assert(iter != _device_map.end());
drvopts = g_slist_append(drvopts, src);
}
- const list< shared_ptr<DevInst> > devices = _device_manager.driver_scan(
- driver, drvopts);
+ const list< shared_ptr<device::DevInst> > devices =
+ _device_manager.driver_scan(driver, drvopts);
g_slist_free_full(drvopts, (GDestroyNotify)free_drvopts);
- BOOST_FOREACH(shared_ptr<DevInst> dev_inst, devices)
+ BOOST_FOREACH(shared_ptr<device::DevInst> dev_inst, devices)
{
assert(dev_inst);
const sr_dev_inst *const sdi = dev_inst->dev_inst();
namespace pv {
class DeviceManager;
+
+namespace device {
class DevInst;
+}
namespace dialogs {
public:
Connect(QWidget *parent, pv::DeviceManager &device_manager);
- boost::shared_ptr<DevInst> get_selected_device() const;
+ boost::shared_ptr<device::DevInst> get_selected_device() const;
private:
void populate_drivers();
QPushButton _scan_button;
QListWidget _device_list;
- std::map<const sr_dev_inst*, boost::shared_ptr<pv::DevInst> >
+ std::map<const sr_dev_inst*, boost::shared_ptr<pv::device::DevInst> >
_device_map;
QDialogButtonBox _button_box;
#include "mainwindow.h"
#include "devicemanager.h"
-#include "devinst.h"
+#include "device/devinst.h"
#include "dialogs/about.h"
#include "dialogs/connect.h"
#include "dialogs/storeprogress.h"
Q_ARG(QString, info_text));
}
-void MainWindow::update_device_list(shared_ptr<pv::DevInst> selected_device)
+void MainWindow::update_device_list(
+ shared_ptr<pv::device::DevInst> selected_device)
{
assert(_sampling_bar);
- const list< shared_ptr<DevInst> > &devices = _device_manager.devices();
+ const list< shared_ptr<device::DevInst> > &devices =
+ _device_manager.devices();
_sampling_bar->set_device_list(devices);
if (!selected_device && !devices.empty()) {
selected_device = devices.front();
// Try and find the demo device and select that by default
- BOOST_FOREACH (shared_ptr<pv::DevInst> dev_inst, devices)
+ BOOST_FOREACH (shared_ptr<pv::device::DevInst> dev_inst, devices)
if (strcmp(dev_inst->dev_inst()->driver->name,
"demo") == 0) {
selected_device = dev_inst;
// If the user selected a device, select it in the device list. Select the
// current device otherwise.
- shared_ptr<DevInst> dev_inst = dlg.exec() ?
+ shared_ptr<device::DevInst> dev_inst = dlg.exec() ?
dlg.get_selected_device() : _session.get_device();
update_device_list(dev_inst);
namespace pv {
class DeviceManager;
+
+namespace device {
class DevInst;
+}
namespace toolbars {
class ContextBar;
* first device in the device list should be selected.
*/
void update_device_list(
- boost::shared_ptr<pv::DevInst> selected_device =
- boost::shared_ptr<pv::DevInst>());
+ boost::shared_ptr<pv::device::DevInst> selected_device =
+ boost::shared_ptr<pv::device::DevInst>());
private slots:
void load_file(QString file_name);
namespace pv {
namespace popups {
-DeviceOptions::DeviceOptions(shared_ptr<DevInst> dev_inst, QWidget *parent) :
+DeviceOptions::DeviceOptions(shared_ptr<device::DevInst> dev_inst,
+ QWidget *parent) :
Popup(parent),
_dev_inst(dev_inst),
_layout(this),
Q_OBJECT
public:
- DeviceOptions(boost::shared_ptr<DevInst> dev_inst, QWidget *parent);
+ DeviceOptions(boost::shared_ptr<device::DevInst> dev_inst,
+ QWidget *parent);
pv::prop::binding::DeviceOptions& binding();
private:
- boost::shared_ptr<DevInst> _dev_inst;
+ boost::shared_ptr<device::DevInst> _dev_inst;
QVBoxLayout _layout;
#include "probes.h"
-#include <pv/devinst.h>
+#include <pv/device/devinst.h>
#include <pv/prop/binding/deviceoptions.h>
#include <pv/sigsession.h>
#include <pv/view/signal.h>
// Create the layout
setLayout(&_layout);
- shared_ptr<DevInst> dev_inst = _session.get_device();
+ shared_ptr<device::DevInst> dev_inst = _session.get_device();
assert(dev_inst);
const sr_dev_inst *const sdi = dev_inst->dev_inst();
assert(sdi);
#include "deviceoptions.h"
-#include <pv/devinst.h>
+#include <pv/device/devinst.h>
#include <pv/prop/bool.h>
#include <pv/prop/double.h>
#include <pv/prop/enum.h>
namespace prop {
namespace binding {
-DeviceOptions::DeviceOptions(shared_ptr<pv::DevInst> dev_inst,
+DeviceOptions::DeviceOptions(shared_ptr<pv::device::DevInst> dev_inst,
const sr_probe_group *group) :
_dev_inst(dev_inst),
_group(group)
{
assert(_dev_inst);
_properties.push_back(shared_ptr<Property>(new Bool(name,
- bind(&DevInst::get_config, _dev_inst, _group, key),
- bind(&DevInst::set_config, _dev_inst, _group, key, _1))));
+ bind(&device::DevInst::get_config, _dev_inst, _group, key),
+ bind(&device::DevInst::set_config, _dev_inst,
+ _group, key, _1))));
}
void DeviceOptions::bind_enum(const QString &name, int key,
values.push_back(make_pair(gvar, printer(gvar)));
_properties.push_back(shared_ptr<Property>(new Enum(name, values,
- bind(&DevInst::get_config, _dev_inst, _group, key),
- bind(&DevInst::set_config, _dev_inst, _group, key, _1))));
+ bind(&device::DevInst::get_config, _dev_inst, _group, key),
+ bind(&device::DevInst::set_config, _dev_inst,
+ _group, key, _1))));
}
void DeviceOptions::bind_int(const QString &name, int key, QString suffix,
assert(_dev_inst);
_properties.push_back(shared_ptr<Property>(new Int(name, suffix, range,
- bind(&DevInst::get_config, _dev_inst, _group, key),
- bind(&DevInst::set_config, _dev_inst, _group, key, _1))));
+ bind(&device::DevInst::get_config, _dev_inst, _group, key),
+ bind(&device::DevInst::set_config, _dev_inst, _group, key, _1))));
}
QString DeviceOptions::print_gvariant(GVariant *const gvar)
namespace pv {
+namespace device {
class DevInst;
+}
namespace prop {
namespace binding {
class DeviceOptions : public Binding
{
public:
- DeviceOptions(boost::shared_ptr<pv::DevInst> dev_inst,
+ DeviceOptions(boost::shared_ptr<pv::device::DevInst> dev_inst,
const sr_probe_group *group = NULL);
private:
static QString print_voltage_threshold(GVariant *const gvar);
protected:
- boost::shared_ptr<DevInst> _dev_inst;
+ boost::shared_ptr<device::DevInst> _dev_inst;
const sr_probe_group *const _group;
};
#include "sigsession.h"
#include "devicemanager.h"
-#include "devinst.h"
+#include "device/devinst.h"
#include "data/analog.h"
#include "data/analogsnapshot.h"
_session = NULL;
}
-shared_ptr<DevInst> SigSession::get_device() const
+shared_ptr<device::DevInst> SigSession::get_device() const
{
return _dev_inst;
}
-void SigSession::set_device(shared_ptr<DevInst> dev_inst)
+void SigSession::set_device(shared_ptr<device::DevInst> dev_inst)
{
// Ensure we are not capturing before setting the device
stop_capture();
update_signals(dev_inst);
}
-void SigSession::release_device(shared_ptr<DevInst> dev_inst)
+void SigSession::release_device(shared_ptr<device::DevInst> dev_inst)
{
(void)dev_inst;
assert(_capture_state == Stopped);
- _dev_inst = shared_ptr<DevInst>();
+ _dev_inst = shared_ptr<device::DevInst>();
}
void SigSession::load_file(const string &name,
return;
}
- shared_ptr<DevInst> dev_inst(
- new DevInst((sr_dev_inst*)devlist->data));
+ shared_ptr<device::DevInst> dev_inst(
+ new device::DevInst((sr_dev_inst*)devlist->data));
g_slist_free(devlist);
_decode_traces.clear();
return;
_decode_traces.clear();
- update_signals(shared_ptr<DevInst>(new DevInst(in->sdi)));
+ update_signals(shared_ptr<device::DevInst>(
+ new device::DevInst(in->sdi)));
read_sample_rate(in->sdi);
_sampling_thread = boost::thread(
return in;
}
-void SigSession::update_signals(shared_ptr<DevInst> dev_inst)
+void SigSession::update_signals(shared_ptr<device::DevInst> dev_inst)
{
assert(dev_inst);
assert(_capture_state == Stopped);
delete in;
}
-void SigSession::sample_thread_proc(shared_ptr<DevInst> dev_inst,
+void SigSession::sample_thread_proc(shared_ptr<device::DevInst> dev_inst,
function<void (const QString)> error_handler)
{
assert(dev_inst);
namespace pv {
class DeviceManager;
-class DevInst;
namespace data {
class Analog;
class SignalData;
}
+namespace device {
+class DevInst;
+}
+
namespace view {
class DecodeTrace;
class LogicSignal;
~SigSession();
- boost::shared_ptr<DevInst> get_device() const;
+ boost::shared_ptr<device::DevInst> get_device() const;
/**
* Sets device instance that will be used in the next capture session.
*/
- void set_device(boost::shared_ptr<DevInst> dev_inst);
+ void set_device(boost::shared_ptr<device::DevInst> dev_inst);
- void release_device(boost::shared_ptr<DevInst> dev_inst);
+ void release_device(boost::shared_ptr<device::DevInst> dev_inst);
void load_file(const std::string &name,
boost::function<void (const QString)> error_handler);
private:
void set_capture_state(capture_state state);
- void update_signals(boost::shared_ptr<DevInst> dev_inst);
+ void update_signals(boost::shared_ptr<device::DevInst> dev_inst);
bool is_trigger_enabled() const;
void load_input_thread_proc(const std::string name, sr_input *in,
boost::function<void (const QString)> error_handler);
- void sample_thread_proc(boost::shared_ptr<DevInst> dev_inst,
+ void sample_thread_proc(boost::shared_ptr<device::DevInst> dev_inst,
boost::function<void (const QString)> error_handler);
void feed_in_header(const sr_dev_inst *sdi);
/**
* The device instance that will be used in the next capture session.
*/
- boost::shared_ptr<DevInst> _dev_inst;
+ boost::shared_ptr<device::DevInst> _dev_inst;
std::vector< boost::shared_ptr<view::DecodeTrace> > _decode_traces;
#include "samplingbar.h"
#include <pv/devicemanager.h>
-#include <pv/devinst.h>
+#include <pv/device/devinst.h>
#include <pv/popups/deviceoptions.h>
#include <pv/popups/probes.h>
}
void SamplingBar::set_device_list(
- const std::list< shared_ptr<pv::DevInst> > &devices)
+ const std::list< shared_ptr<pv::device::DevInst> > &devices)
{
_updating_device_selector = true;
_device_selector.clear();
_device_selector_map.clear();
- BOOST_FOREACH (shared_ptr<pv::DevInst> dev_inst, devices) {
+ BOOST_FOREACH (shared_ptr<pv::device::DevInst> dev_inst, devices) {
assert(dev_inst);
const string title = dev_inst->format_device_title();
const sr_dev_inst *sdi = dev_inst->dev_inst();
on_device_selected();
}
-shared_ptr<pv::DevInst> SamplingBar::get_selected_device() const
+shared_ptr<pv::device::DevInst> SamplingBar::get_selected_device() const
{
const int index = _device_selector.currentIndex();
if (index < 0)
- return shared_ptr<pv::DevInst>();
+ return shared_ptr<pv::device::DevInst>();
const sr_dev_inst *const sdi =
(const sr_dev_inst*)_device_selector.itemData(
index).value<void*>();
assert(sdi);
- map<const sr_dev_inst*, boost::weak_ptr<DevInst> >::
+ map<const sr_dev_inst*, boost::weak_ptr<device::DevInst> >::
const_iterator iter = _device_selector_map.find(sdi);
if (iter == _device_selector_map.end())
- return shared_ptr<pv::DevInst>();
+ return shared_ptr<pv::device::DevInst>();
- return shared_ptr<pv::DevInst>((*iter).second);
+ return shared_ptr<pv::device::DevInst>((*iter).second);
}
-void SamplingBar::set_selected_device(boost::shared_ptr<pv::DevInst> dev_inst)
+void SamplingBar::set_selected_device(shared_ptr<pv::device::DevInst> dev_inst)
{
assert(dev_inst);
if (_updating_sample_rate)
return;
- const shared_ptr<DevInst> dev_inst = get_selected_device();
+ const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
if (_updating_sample_rate)
return;
- const shared_ptr<DevInst> dev_inst = get_selected_device();
+ const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
if (_updating_sample_count)
return;
- const shared_ptr<DevInst> dev_inst = get_selected_device();
+ const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
if (_updating_sample_count)
return;
- const shared_ptr<DevInst> dev_inst = get_selected_device();
+ const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
if (_updating_sample_rate)
return;
- const shared_ptr<DevInst> dev_inst = get_selected_device();
+ const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
if (_updating_device_selector)
return;
- const shared_ptr<DevInst> dev_inst = get_selected_device();
+ const shared_ptr<device::DevInst> dev_inst = get_selected_device();
if (!dev_inst)
return;
namespace pv {
-class DevInst;
class SigSession;
+namespace device {
+class DevInst;
+}
+
namespace toolbars {
class SamplingBar : public QToolBar
SamplingBar(SigSession &session, QWidget *parent);
void set_device_list(
- const std::list< boost::shared_ptr<pv::DevInst> > &devices);
+ const std::list< boost::shared_ptr<pv::device::DevInst> >
+ &devices);
- boost::shared_ptr<pv::DevInst> get_selected_device() const;
- void set_selected_device(boost::shared_ptr<pv::DevInst> dev_inst);
+ boost::shared_ptr<pv::device::DevInst> get_selected_device() const;
+ void set_selected_device(
+ boost::shared_ptr<pv::device::DevInst> dev_inst);
void set_capture_state(pv::SigSession::capture_state state);
SigSession &_session;
QComboBox _device_selector;
- std::map<const sr_dev_inst*, boost::weak_ptr<DevInst> >
+ std::map<const sr_dev_inst*, boost::weak_ptr<device::DevInst> >
_device_selector_map;
bool _updating_device_selector;
const float AnalogSignal::EnvelopeThreshold = 256.0f;
-AnalogSignal::AnalogSignal(shared_ptr<pv::DevInst> dev_inst,
+AnalogSignal::AnalogSignal(shared_ptr<pv::device::DevInst> dev_inst,
const sr_probe *const probe, shared_ptr<data::Analog> data) :
Signal(dev_inst, probe),
_data(data),
static const float EnvelopeThreshold;
public:
- AnalogSignal(boost::shared_ptr<pv::DevInst> dev_inst,
+ AnalogSignal(boost::shared_ptr<pv::device::DevInst> dev_inst,
const sr_probe *const probe,
boost::shared_ptr<pv::data::Analog> data);
#include "view.h"
#include <pv/sigsession.h>
-#include <pv/devinst.h>
+#include <pv/device/devinst.h>
#include <pv/data/logic.h>
#include <pv/data/logicsnapshot.h>
#include <pv/view/view.h>
QColor(0xEE, 0xEE, 0xEC), // White
};
-LogicSignal::LogicSignal(shared_ptr<pv::DevInst> dev_inst,
+LogicSignal::LogicSignal(shared_ptr<pv::device::DevInst> dev_inst,
const sr_probe *const probe, shared_ptr<data::Logic> data) :
Signal(dev_inst, probe),
_data(data),
static const QColor SignalColours[10];
public:
- LogicSignal(boost::shared_ptr<pv::DevInst> dev_inst,
+ LogicSignal(boost::shared_ptr<pv::device::DevInst> dev_inst,
const sr_probe *const probe,
boost::shared_ptr<pv::data::Logic> data);
#include "signal.h"
#include "view.h"
-#include <pv/devinst.h>
+#include <pv/device/devinst.h>
using boost::shared_ptr;
"SCL"
};
-Signal::Signal(shared_ptr<pv::DevInst> dev_inst,
+Signal::Signal(shared_ptr<pv::device::DevInst> dev_inst,
const sr_probe *const probe) :
Trace(probe->name),
_dev_inst(dev_inst),
namespace pv {
-class DevInst;
-
namespace data {
class SignalData;
}
+namespace device {
+class DevInst;
+}
+
namespace view {
class Signal : public Trace
Q_OBJECT
protected:
- Signal(boost::shared_ptr<pv::DevInst> dev_inst,
+ Signal(boost::shared_ptr<pv::device::DevInst> dev_inst,
const sr_probe *const probe);
public:
void on_disable();
protected:
- boost::shared_ptr<pv::DevInst> _dev_inst;
+ boost::shared_ptr<pv::device::DevInst> _dev_inst;
const sr_probe *const _probe;
QComboBox *_name_widget;
set(pulseview_TEST_SOURCES
${PROJECT_SOURCE_DIR}/pv/devicemanager.cpp
- ${PROJECT_SOURCE_DIR}/pv/devinst.cpp
${PROJECT_SOURCE_DIR}/pv/sigsession.cpp
${PROJECT_SOURCE_DIR}/pv/view/cursorpair.cpp
${PROJECT_SOURCE_DIR}/pv/data/analog.cpp
${PROJECT_SOURCE_DIR}/pv/data/logicsnapshot.cpp
${PROJECT_SOURCE_DIR}/pv/data/snapshot.cpp
${PROJECT_SOURCE_DIR}/pv/data/signaldata.cpp
+ ${PROJECT_SOURCE_DIR}/pv/device/devinst.cpp
${PROJECT_SOURCE_DIR}/pv/prop/int.cpp
${PROJECT_SOURCE_DIR}/pv/prop/property.cpp
${PROJECT_SOURCE_DIR}/pv/prop/string.cpp
# This list includes only QObject derived class headers.
set(pulseview_TEST_HEADERS
${PROJECT_SOURCE_DIR}/pv/sigsession.h
- ${PROJECT_SOURCE_DIR}/pv/devinst.h
+ ${PROJECT_SOURCE_DIR}/pv/device/devinst.h
${PROJECT_SOURCE_DIR}/pv/prop/int.h
${PROJECT_SOURCE_DIR}/pv/prop/property.h
${PROJECT_SOURCE_DIR}/pv/prop/string.h