RTXI  3.0.0
The Real-Time eXperiment Interface Reference Manual
system_control.hpp
Go to the documentation of this file.
1 /*
2  The Real-Time eXperiment Interface (RTXI)
3  Copyright (C) 2011 Georgia Institute of Technology, University of Utah,
4  Weill Cornell Medical College
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 SYSTEM_CONTROL_H
21 #define SYSTEM_CONTROL_H
22 
23 #include <QComboBox>
24 #include <utility>
25 
26 #include "daq.hpp"
27 #include "event.hpp"
28 #include "main_window.hpp"
29 #include "widgets.hpp"
30 
31 Q_DECLARE_METATYPE(DAQ::ChannelType::type_t)
32 Q_DECLARE_METATYPE(DAQ::Device*)
33 Q_DECLARE_METATYPE(DAQ::direction_t)
34 Q_DECLARE_METATYPE(DAQ::Reference::reference_t)
35 Q_DECLARE_METATYPE(DAQ::analog_range_t)
36 
37 namespace SystemControl
38 {
39 
40 constexpr std::string_view MODULE_NAME = "Control Panel";
41 
42 class Panel : public Widgets::Panel
43 {
44  Q_OBJECT
45 
46 public:
47  Panel(QMainWindow* mw, Event::Manager* ev_manager);
48 
49  void receiveEvent(const Event::Object* event);
50 
51 public slots:
52  void apply();
53  void display();
54  void displayAnalogGroup();
55  void displayDigitalGroup();
56  void updateDevice();
57  void updateFreq();
58  void updatePeriod();
59 
60 private:
61  void buildDAQDeviceList();
62  void submitAnalogChannelUpdate();
63  void submitDigitalChannelUpdate();
64 
65  QGroupBox* deviceGroup = nullptr;
66  QGroupBox* analogGroup = nullptr;
67  QGroupBox* digitalGroup = nullptr;
68  QGroupBox* buttonGroup = nullptr;
69 
70  QMdiSubWindow* subWindow = nullptr;
71 
72  QComboBox* deviceList = nullptr;
73  QComboBox* analogChannelList = nullptr;
74  QComboBox* analogRangeList = nullptr;
75  QComboBox* analogDownsampleList = nullptr;
76  QComboBox* analogReferenceList = nullptr;
77  QComboBox* analogSubdeviceList = nullptr;
78  QComboBox* analogUnitPrefixList = nullptr;
79  QComboBox* analogUnitList = nullptr;
80  QComboBox* analogUnitPrefixList2 = nullptr;
81  QComboBox* analogUnitList2 = nullptr;
82  QLineEdit* analogGainEdit = nullptr;
83  QLineEdit* analogZeroOffsetEdit = nullptr;
84  QPushButton* analogActiveButton = nullptr;
85  QPushButton* analogCalibrationButton = nullptr;
86 
87  QComboBox* digitalChannelList = nullptr;
88  QComboBox* digitalDirectionList = nullptr;
89  QComboBox* digitalSubdeviceList = nullptr;
90  QPushButton* digitalActiveButton = nullptr;
91 
92  bool rateUpdate = false;
93  QComboBox* freqUnitList = nullptr;
94  QComboBox* periodUnitList = nullptr;
95  QLineEdit* freqEdit = nullptr;
96  QLineEdit* periodEdit = nullptr;
97 };
98 
99 class Plugin : public Widgets::Plugin
100 {
101 public:
102  explicit Plugin(Event::Manager* ev_manager)
103  : Widgets::Plugin(ev_manager, std::string(MODULE_NAME))
104  {
105  }
106 };
107 
108 std::unique_ptr<Widgets::Plugin> createRTXIPlugin(Event::Manager* ev_manager);
109 
110 Widgets::Panel* createRTXIPanel(QMainWindow* main_window,
111  Event::Manager* ev_manager);
112 
113 std::unique_ptr<Widgets::Component> createRTXIComponent(
114  Widgets::Plugin* host_plugin);
115 
117 
118 } // namespace SystemControl
119 #endif /* SYSTEM_CONTROL_H */
void receiveEvent(const Event::Object *event)
Plugin(Event::Manager *ev_manager)
std::pair< double, double > analog_range_t
Definition: daq.hpp:39
direction_t
Definition: daq.hpp:93
std::unique_ptr< Widgets::Plugin > createRTXIPlugin(Event::Manager *ev_manager)
constexpr std::string_view MODULE_NAME
Widgets::FactoryMethods getFactories()
std::unique_ptr< Widgets::Component > createRTXIComponent(Widgets::Plugin *host_plugin)
Widgets::Panel * createRTXIPanel(QMainWindow *main_window, Event::Manager *ev_manager)
Definition: rt.hpp:35