pv/data/logicsnapshot.cpp
pv/data/signaldata.cpp
pv/data/snapshot.cpp
+ pv/device/device.cpp
pv/device/devinst.cpp
pv/dialogs/about.cpp
pv/dialogs/connect.cpp
--- /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 <sstream>
+
+#include <libsigrok/libsigrok.h>
+
+#include "device.h"
+
+using std::ostringstream;
+using std::string;
+
+namespace pv {
+namespace device {
+
+Device::Device(sr_dev_inst *sdi) :
+ DevInst(sdi)
+{
+}
+
+std::string Device::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();
+}
+
+} // 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_DEVICE_H
+#define PULSEVIEW_PV_DEVICE_DEVICE_H
+
+#include "devinst.h"
+
+namespace pv {
+namespace device {
+
+class Device : public DevInst
+{
+public:
+ Device(sr_dev_inst *dev_inst);
+
+ std::string format_device_title() const;
+};
+
+} // device
+} // pv
+
+#endif // PULSVIEW_PV_DEVICE_DEVICE_H
*/
#include <cassert>
-#include <sstream>
#include <QDebug>
#include "devinst.h"
-using std::ostringstream;
-using std::string;
-
namespace pv {
namespace device {
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;
{
Q_OBJECT
-public:
+protected:
DevInst(sr_dev_inst *sdi);
+public:
sr_dev_inst* dev_inst() const;
- std::string format_device_title() const;
+ virtual std::string format_device_title() const = 0;
GVariant* get_config(const sr_probe_group *group, int key);
signals:
void config_changed();
-private:
+protected:
sr_dev_inst *const _sdi;
};
*/
#include "devicemanager.h"
-#include "device/devinst.h"
+#include "device/device.h"
#include "sigsession.h"
#include <cassert>
GSList *const devices = sr_driver_scan(driver, drvopts);
for (GSList *l = devices; l; l = l->next)
driver_devices.push_back(shared_ptr<device::DevInst>(
- new device::DevInst((sr_dev_inst*)l->data)));
+ new device::Device((sr_dev_inst*)l->data)));
g_slist_free(devices);
driver_devices.sort(compare_devices);
#include "sigsession.h"
#include "devicemanager.h"
-#include "device/devinst.h"
+#include "device/device.h"
#include "data/analog.h"
#include "data/analogsnapshot.h"
}
shared_ptr<device::DevInst> dev_inst(
- new device::DevInst((sr_dev_inst*)devlist->data));
+ new device::Device((sr_dev_inst*)devlist->data));
g_slist_free(devlist);
_decode_traces.clear();
_decode_traces.clear();
update_signals(shared_ptr<device::DevInst>(
- new device::DevInst(in->sdi)));
+ new device::Device(in->sdi)));
read_sample_rate(in->sdi);
_sampling_thread = boost::thread(
${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/device.cpp
${PROJECT_SOURCE_DIR}/pv/device/devinst.cpp
${PROJECT_SOURCE_DIR}/pv/prop/int.cpp
${PROJECT_SOURCE_DIR}/pv/prop/property.cpp