]>
Commit | Line | Data |
---|---|---|
572e76fe UH |
1 | /* |
2 | * This file is part of the libsigrokflow project. | |
3 | * | |
4 | * Copyright (C) 2018 Uwe Hermann <uwe@hermann-uwe.de> | |
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 3 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, see <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
20 | #ifndef LIBSIGROKFLOW_LIBSIGROKFLOW_HPP | |
21 | #define LIBSIGROKFLOW_LIBSIGROKFLOW_HPP | |
22 | ||
f7363af1 ML |
23 | #include <gstreamermm.h> |
24 | #include <libsigrokcxx/libsigrokcxx.hpp> | |
25 | ||
b903bb0a UH |
26 | namespace Srf |
27 | { | |
28 | ||
f7363af1 ML |
29 | using namespace std; |
30 | ||
b903bb0a UH |
31 | void init(); |
32 | ||
f7363af1 ML |
33 | class Block |
34 | { | |
35 | /* Config API etc goes here */ | |
36 | }; | |
37 | ||
38 | class GstBlock : | |
39 | public Gst::Element | |
40 | { | |
41 | /* Operations specific to sigrok GStreamer blocks go here. */ | |
42 | }; | |
43 | ||
44 | class Device : | |
45 | public GstBlock | |
46 | { | |
47 | /* Operations specific to hardware devices go here */ | |
48 | }; | |
b903bb0a | 49 | |
f7363af1 ML |
50 | class CaptureDevice : |
51 | public Device | |
52 | { | |
53 | /* Operations specific to capture (source) devices go here */ | |
54 | protected : | |
55 | CaptureDevice(); | |
56 | }; | |
57 | ||
58 | class LegacyCaptureDevice : | |
59 | public CaptureDevice | |
60 | { | |
61 | public: | |
62 | /* Construct from libsigrok device object */ | |
d03b3a98 | 63 | LegacyCaptureDevice(shared_ptr<sigrok::HardwareDevice>); |
f7363af1 ML |
64 | |
65 | /* Retrieve libsigrok device object */ | |
d03b3a98 ML |
66 | shared_ptr<sigrok::HardwareDevice> libsigrok_device(); |
67 | ||
68 | /* Override state change */ | |
69 | Gst::StateChangeReturn change_state_vfunc(Gst::StateChange transition); | |
f7363af1 | 70 | private: |
d03b3a98 ML |
71 | shared_ptr<sigrok::HardwareDevice> _device; |
72 | Glib::RefPtr<Gst::Pad> _src_pad; | |
73 | Glib::Threads::RecMutex _mutex; | |
74 | Glib::RefPtr<Gst::Task> _task; | |
75 | shared_ptr<sigrok::Session> _session; | |
76 | ||
77 | void _datafeed_callback(shared_ptr<sigrok::Device> device, | |
78 | shared_ptr<sigrok::Packet> packet); | |
79 | void _run(); | |
f7363af1 ML |
80 | }; |
81 | ||
82 | ||
83 | } | |
572e76fe | 84 | #endif |