| 
									
										
										
										
											2017-12-17 09:25:08 +00:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2023-11-19 04:24:06 +00:00
										 |  |  | // Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
 | 
					
						
							|  |  |  | // written by Christian Daniel                                                   //
 | 
					
						
							|  |  |  | // Copyright (C) 2015-2021 Edouard Griffiths, F4EXB <f4exb06@gmail.com>          //
 | 
					
						
							|  |  |  | // Copyright (C) 2019 Davide Gerhard <rainbow@irh.it>                            //
 | 
					
						
							| 
									
										
										
										
											2017-12-17 09:25:08 +00:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // Swagger server adapter interface                                              //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify          //
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by          //
 | 
					
						
							|  |  |  | // the Free Software Foundation as version 3 of the License, or                  //
 | 
					
						
							| 
									
										
										
										
											2019-04-11 12:44:23 +00:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2017-12-17 09:25:08 +00:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,               //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-10 03:10:46 +00:00
										 |  |  | #ifndef SDRSRV_MAINSERVER_H_
 | 
					
						
							|  |  |  | #define SDRSRV_MAINSERVER_H_
 | 
					
						
							| 
									
										
										
										
											2017-12-17 09:25:08 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <QObject>
 | 
					
						
							| 
									
										
										
										
											2017-12-17 10:09:51 +00:00
										 |  |  | #include <QTimer>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-09 06:52:30 +00:00
										 |  |  | #include "maincore.h"
 | 
					
						
							| 
									
										
										
										
											2017-12-17 10:09:51 +00:00
										 |  |  | #include "util/messagequeue.h"
 | 
					
						
							| 
									
										
										
										
											2018-03-20 12:49:21 +00:00
										 |  |  | #include "export.h"
 | 
					
						
							| 
									
										
										
										
											2017-12-17 09:25:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-10 03:10:46 +00:00
										 |  |  | class MainParser; | 
					
						
							| 
									
										
										
										
											2017-12-17 09:25:08 +00:00
										 |  |  | class DSPEngine; | 
					
						
							|  |  |  | class DSPDeviceSourceEngine; | 
					
						
							|  |  |  | class DSPDeviceSinkEngine; | 
					
						
							|  |  |  | class PluginAPI; | 
					
						
							|  |  |  | class PluginInterface; | 
					
						
							|  |  |  | class ChannelMarker; | 
					
						
							| 
									
										
										
										
											2017-12-17 22:15:42 +00:00
										 |  |  | class DeviceSet; | 
					
						
							| 
									
										
										
										
											2020-09-21 01:13:36 +00:00
										 |  |  | class FeatureSet; | 
					
						
							| 
									
										
										
										
											2017-12-17 09:25:08 +00:00
										 |  |  | class WebAPIRequestMapper; | 
					
						
							|  |  |  | class WebAPIServer; | 
					
						
							| 
									
										
										
										
											2020-10-11 10:39:30 +00:00
										 |  |  | class WebAPIAdapter; | 
					
						
							| 
									
										
										
										
											2017-12-17 09:25:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-17 10:09:51 +00:00
										 |  |  | namespace qtwebapp { | 
					
						
							|  |  |  |     class LoggerWithFile; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-08 20:33:08 +00:00
										 |  |  | class SDRSRV_API MainServer : public QObject { | 
					
						
							| 
									
										
										
										
											2017-12-17 09:25:08 +00:00
										 |  |  |     Q_OBJECT | 
					
						
							| 
									
										
										
										
											2017-12-17 10:09:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-10-08 20:33:08 +00:00
										 |  |  |     explicit MainServer(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QObject *parent = 0); | 
					
						
							|  |  |  |     ~MainServer(); | 
					
						
							|  |  |  |     static MainServer *getInstance() { return m_instance; } // Main Core is de facto a singleton so this just returns its reference
 | 
					
						
							| 
									
										
										
										
											2017-12-17 10:09:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-09 06:52:30 +00:00
										 |  |  |     const QTimer& getMasterTimer() const { return m_mainCore->m_masterTimer; } | 
					
						
							| 
									
										
										
										
											2017-12-17 10:09:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-20 00:01:53 +00:00
										 |  |  |     void addSourceDevice(); | 
					
						
							|  |  |  |     void addSinkDevice(); | 
					
						
							| 
									
										
										
										
											2020-11-10 11:15:19 +00:00
										 |  |  |     void addMIMODevice(); | 
					
						
							| 
									
										
										
										
											2017-12-20 00:01:53 +00:00
										 |  |  |     void removeLastDevice(); | 
					
						
							| 
									
										
										
										
											2017-12-21 23:07:59 +00:00
										 |  |  |     void changeSampleSource(int deviceSetIndex, int selectedDeviceIndex); | 
					
						
							|  |  |  |     void changeSampleSink(int deviceSetIndex, int selectedDeviceIndex); | 
					
						
							| 
									
										
										
										
											2019-12-29 05:01:14 +00:00
										 |  |  |     void changeSampleMIMO(int deviceSetIndex, int selectedDeviceIndex); | 
					
						
							| 
									
										
										
										
											2017-12-22 17:19:49 +00:00
										 |  |  |     void addChannel(int deviceSetIndex, int selectedChannelIndex); | 
					
						
							| 
									
										
										
										
											2017-12-23 21:33:30 +00:00
										 |  |  |     void deleteChannel(int deviceSetIndex, int channelIndex); | 
					
						
							| 
									
										
										
										
											2021-08-21 18:09:57 +00:00
										 |  |  |     void addFeatureSet(); | 
					
						
							|  |  |  |     void removeFeatureSet(unsigned int featureSetIndex); | 
					
						
							| 
									
										
										
										
											2020-11-14 10:13:32 +00:00
										 |  |  |     void addFeature(int featureSetIndex, int selectedFeatureIndex); | 
					
						
							| 
									
										
										
										
											2020-09-21 01:13:36 +00:00
										 |  |  |     void deleteFeature(int featureSetIndex, int featureIndex); | 
					
						
							| 
									
										
										
										
											2017-12-20 00:01:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-12 00:22:48 +00:00
										 |  |  |     friend class WebAPIAdapter; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-17 11:08:18 +00:00
										 |  |  | signals: | 
					
						
							|  |  |  |     void finished(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-17 10:09:51 +00:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2020-10-08 20:33:08 +00:00
										 |  |  |     static MainServer *m_instance; | 
					
						
							| 
									
										
										
										
											2020-10-09 06:52:30 +00:00
										 |  |  |     MainCore *m_mainCore; | 
					
						
							| 
									
										
										
										
											2017-12-17 10:09:51 +00:00
										 |  |  |     DSPEngine* m_dspEngine; | 
					
						
							| 
									
										
										
										
											2017-12-17 22:15:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     MessageQueue m_inputMessageQueue; | 
					
						
							| 
									
										
										
										
											2017-12-17 10:09:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     WebAPIRequestMapper *m_requestMapper; | 
					
						
							|  |  |  |     WebAPIServer *m_apiServer; | 
					
						
							| 
									
										
										
										
											2020-10-11 10:39:30 +00:00
										 |  |  |     WebAPIAdapter *m_apiAdapter; | 
					
						
							| 
									
										
										
										
											2017-12-17 22:15:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-18 12:56:10 +00:00
										 |  |  | 	void loadSettings(); | 
					
						
							| 
									
										
										
										
											2019-08-13 10:18:47 +00:00
										 |  |  |     void applySettings(); | 
					
						
							| 
									
										
										
										
											2017-12-20 13:31:17 +00:00
										 |  |  | 	void loadPresetSettings(const Preset* preset, int tabIndex); | 
					
						
							| 
									
										
										
										
											2017-12-20 00:01:53 +00:00
										 |  |  | 	void savePresetSettings(Preset* preset, int tabIndex); | 
					
						
							| 
									
										
										
										
											2020-09-24 03:38:05 +00:00
										 |  |  | 	void loadFeatureSetPresetSettings(const FeatureSetPreset* preset, int featureSetIndex); | 
					
						
							|  |  |  | 	void saveFeatureSetPresetSettings(FeatureSetPreset* preset, int featureSetIndex); | 
					
						
							| 
									
										
										
										
											2017-12-18 12:56:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-17 22:15:42 +00:00
										 |  |  |     bool handleMessage(const Message& cmd); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private slots: | 
					
						
							|  |  |  |     void handleMessages(); | 
					
						
							| 
									
										
										
										
											2017-12-17 09:25:08 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-10 03:10:46 +00:00
										 |  |  | #endif /* SDRSRV_MAINSERVER_H_ */
 |