2 * This file is part of the SmuView project.
4 * Copyright (C) 2017-2021 Frank Stettner <frank-stettner@gmx.net>
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.
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.
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/>.
33 using std::shared_ptr
;
52 class SmuScriptRunner
;
55 class Session
: public QObject
60 static shared_ptr
<sigrok::Context
> sr_context
;
61 // TODO: use std::chrono / std::time
62 static double session_start_timestamp
;
65 explicit Session(DeviceManager
&device_manager
);
68 DeviceManager
&device_manager();
69 const DeviceManager
&device_manager() const;
71 map
<string
, shared_ptr
<devices::BaseDevice
>> device_map() const;
72 list
<shared_ptr
<devices::HardwareDevice
>> connect_device(
73 const string
&conn_string
);
74 void add_device(shared_ptr
<devices::BaseDevice
> device
);
75 shared_ptr
<devices::UserDevice
> add_user_device();
76 void remove_device(shared_ptr
<devices::BaseDevice
> device
);
78 shared_ptr
<python::SmuScriptRunner
> smu_script_runner();
79 void run_smu_script(const string
&script_file
);
81 void set_main_window(MainWindow
*main_window
);
82 MainWindow
*main_window() const;
85 DeviceManager
&device_manager_
;
86 map
<string
, shared_ptr
<devices::BaseDevice
>> device_map_
;
87 MainWindow
*main_window_
;
88 shared_ptr
<python::SmuScriptRunner
> smu_script_runner_
;
90 void free_unused_memory();
93 void error_handler(const std::string
&sender
, const std::string
&msg
);
96 void device_added(shared_ptr
<sv::devices::BaseDevice
> device
);
97 void device_removed(shared_ptr
<sv::devices::BaseDevice
> device
);
103 #endif // SESSION_HPP