]>
Commit | Line | Data |
---|---|---|
107ca6d3 JH |
1 | /* |
2 | * This file is part of the PulseView project. | |
3 | * | |
4 | * Copyright (C) 2013 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 | |
efdec55a | 17 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
107ca6d3 JH |
18 | */ |
19 | ||
7a01bd36 JH |
20 | #ifndef PULSEVIEW_PV_DEVICEMANAGER_HPP |
21 | #define PULSEVIEW_PV_DEVICEMANAGER_HPP | |
107ca6d3 | 22 | |
107ca6d3 | 23 | #include <list> |
6842b5fc | 24 | #include <map> |
f9abf97e | 25 | #include <memory> |
dd63af74 | 26 | #include <string> |
107ca6d3 | 27 | |
e8d00928 | 28 | namespace Glib { |
c732664f | 29 | class VariantBase; |
e8d00928 ML |
30 | } |
31 | ||
32 | namespace sigrok { | |
c732664f JH |
33 | class ConfigKey; |
34 | class Context; | |
35 | class Driver; | |
e8d00928 | 36 | } |
107ca6d3 JH |
37 | |
38 | namespace pv { | |
39 | ||
da30ecb7 JH |
40 | namespace devices { |
41 | class Device; | |
42 | class HardwareDevice; | |
43 | } | |
44 | ||
2b81ae46 | 45 | class Session; |
dc0867ff | 46 | |
107ca6d3 JH |
47 | class DeviceManager |
48 | { | |
49 | public: | |
e8d00928 | 50 | DeviceManager(std::shared_ptr<sigrok::Context> context); |
107ca6d3 | 51 | |
c6246dc5 | 52 | ~DeviceManager() = default; |
107ca6d3 | 53 | |
72d85f36 JH |
54 | const std::shared_ptr<sigrok::Context>& context() const; |
55 | ||
e8d00928 | 56 | std::shared_ptr<sigrok::Context> context(); |
6842b5fc | 57 | |
da30ecb7 | 58 | const std::list< std::shared_ptr<devices::HardwareDevice> >& |
e8d00928 | 59 | devices() const; |
107ca6d3 | 60 | |
da30ecb7 | 61 | std::list< std::shared_ptr<devices::HardwareDevice> > driver_scan( |
e8d00928 ML |
62 | std::shared_ptr<sigrok::Driver> driver, |
63 | std::map<const sigrok::ConfigKey *, Glib::VariantBase> drvopts); | |
107ca6d3 | 64 | |
e8d00928 | 65 | const std::map<std::string, std::string> get_device_info( |
da30ecb7 | 66 | const std::shared_ptr<devices::Device> device); |
107ca6d3 | 67 | |
da30ecb7 | 68 | const std::shared_ptr<devices::HardwareDevice> find_device_from_info( |
e8d00928 | 69 | const std::map<std::string, std::string> search_info); |
dc0867ff | 70 | |
107ca6d3 | 71 | private: |
da30ecb7 JH |
72 | bool compare_devices(std::shared_ptr<devices::Device> a, |
73 | std::shared_ptr<devices::Device> b); | |
e8d00928 ML |
74 | |
75 | protected: | |
8dbbc7f0 | 76 | std::shared_ptr<sigrok::Context> context_; |
da30ecb7 | 77 | std::list< std::shared_ptr<devices::HardwareDevice> > devices_; |
107ca6d3 JH |
78 | }; |
79 | ||
80 | } // namespace pv | |
81 | ||
7a01bd36 | 82 | #endif // PULSEVIEW_PV_DEVICEMANAGER_HPP |