]> sigrok.org Git - pulseview.git/blame - pv/device/devinst.h
Update to new session API.
[pulseview.git] / pv / device / devinst.h
CommitLineData
19adbc2c
JH
1/*
2 * This file is part of the PulseView project.
3 *
4 * Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
94574501
JH
21#ifndef PULSEVIEW_PV_DEVICE_DEVINST_H
22#define PULSEVIEW_PV_DEVICE_DEVINST_H
19adbc2c 23
f9abf97e 24#include <memory>
19adbc2c
JH
25#include <string>
26
42e634cf
JH
27#include <QObject>
28
8dd44190
JH
29#include <glib.h>
30
27d7c96b
DK
31#include <stdint.h>
32
19adbc2c 33struct sr_dev_inst;
4871ed92 34struct sr_channel;
2445160a 35struct sr_channel_group;
19adbc2c 36
bb3030b3 37#include <pv/sigsession.h>
996b7c9d 38
bb3030b3 39namespace pv {
996b7c9d 40
94574501 41namespace device {
19adbc2c 42
42e634cf 43class DevInst : public QObject
19adbc2c 44{
42e634cf
JH
45 Q_OBJECT
46
921b90c0 47protected:
29efe92a 48 DevInst();
19adbc2c 49
921b90c0 50public:
29efe92a 51 virtual sr_dev_inst* dev_inst() const = 0;
19adbc2c 52
ae2d1bc5 53 virtual void use(SigSession *owner) throw(QString);
996b7c9d 54
ae2d1bc5 55 virtual void release();
996b7c9d
JH
56
57 SigSession* owner() const;
58
921b90c0 59 virtual std::string format_device_title() const = 0;
19adbc2c 60
2445160a 61 GVariant* get_config(const sr_channel_group *group, int key);
8dd44190 62
2445160a 63 bool set_config(const sr_channel_group *group, int key, GVariant *data);
8dd44190 64
2445160a 65 GVariant* list_config(const sr_channel_group *group, int key);
8dd44190 66
4871ed92 67 void enable_probe(const sr_channel *probe, bool enable = true);
e183f4e3 68
27d7c96b
DK
69 /**
70 * @brief Gets the sample limit from the driver.
71 *
72 * @return The returned sample limit from the driver, or 0 if the
73 * sample limit could not be read.
74 */
75 uint64_t get_sample_limit();
76
07dcf561
JH
77 virtual bool is_trigger_enabled() const;
78
ae2d1bc5
JH
79public:
80 virtual void start();
81
82 virtual void run();
83
42e634cf
JH
84signals:
85 void config_changed();
86
921b90c0 87protected:
996b7c9d 88 SigSession *_owner;
19adbc2c
JH
89};
90
94574501 91} // device
19adbc2c
JH
92} // pv
93
94574501 94#endif // PULSEVIEW_PV_DEVICE_DEVINST_H