2017-12-17 04:25:08 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2017 Edouard Griffiths, F4EXB. //
|
|
|
|
// //
|
|
|
|
// 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 08:44:23 -04:00
|
|
|
// (at your option) any later version. //
|
2017-12-17 04:25:08 -05: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-09 23:10:46 -04:00
|
|
|
#ifndef SDRSRV_MAINSERVER_H_
|
|
|
|
#define SDRSRV_MAINSERVER_H_
|
2017-12-17 04:25:08 -05:00
|
|
|
|
|
|
|
#include <QObject>
|
2017-12-17 05:09:51 -05:00
|
|
|
#include <QTimer>
|
|
|
|
|
2020-10-09 02:52:30 -04:00
|
|
|
#include "maincore.h"
|
2017-12-17 05:09:51 -05:00
|
|
|
#include "settings/mainsettings.h"
|
|
|
|
#include "util/messagequeue.h"
|
2018-03-20 08:49:21 -04:00
|
|
|
#include "export.h"
|
2017-12-17 04:25:08 -05:00
|
|
|
|
2020-10-09 23:10:46 -04:00
|
|
|
class MainParser;
|
2017-12-17 04:25:08 -05:00
|
|
|
class DSPEngine;
|
|
|
|
class DSPDeviceSourceEngine;
|
|
|
|
class DSPDeviceSinkEngine;
|
|
|
|
class PluginAPI;
|
|
|
|
class PluginInterface;
|
|
|
|
class ChannelMarker;
|
2017-12-17 17:15:42 -05:00
|
|
|
class DeviceSet;
|
2020-09-20 21:13:36 -04:00
|
|
|
class FeatureSet;
|
2017-12-17 04:25:08 -05:00
|
|
|
class WebAPIRequestMapper;
|
|
|
|
class WebAPIServer;
|
2020-10-11 06:39:30 -04:00
|
|
|
class WebAPIAdapter;
|
2017-12-17 04:25:08 -05:00
|
|
|
|
2017-12-17 05:09:51 -05:00
|
|
|
namespace qtwebapp {
|
|
|
|
class LoggerWithFile;
|
|
|
|
}
|
|
|
|
|
2020-10-08 16:33:08 -04:00
|
|
|
class SDRSRV_API MainServer : public QObject {
|
2017-12-17 04:25:08 -05:00
|
|
|
Q_OBJECT
|
2017-12-17 05:09:51 -05:00
|
|
|
|
|
|
|
public:
|
2020-10-08 16:33:08 -04: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 05:09:51 -05:00
|
|
|
|
|
|
|
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
|
|
|
|
|
2020-10-09 02:52:30 -04:00
|
|
|
const QTimer& getMasterTimer() const { return m_mainCore->m_masterTimer; }
|
2017-12-17 05:09:51 -05:00
|
|
|
|
2017-12-19 19:01:53 -05:00
|
|
|
void addSourceDevice();
|
|
|
|
void addSinkDevice();
|
2020-11-10 06:15:19 -05:00
|
|
|
void addMIMODevice();
|
2017-12-19 19:01:53 -05:00
|
|
|
void removeLastDevice();
|
2017-12-21 18:07:59 -05:00
|
|
|
void changeSampleSource(int deviceSetIndex, int selectedDeviceIndex);
|
|
|
|
void changeSampleSink(int deviceSetIndex, int selectedDeviceIndex);
|
2019-12-29 00:01:14 -05:00
|
|
|
void changeSampleMIMO(int deviceSetIndex, int selectedDeviceIndex);
|
2017-12-22 12:19:49 -05:00
|
|
|
void addChannel(int deviceSetIndex, int selectedChannelIndex);
|
2017-12-23 16:33:30 -05:00
|
|
|
void deleteChannel(int deviceSetIndex, int channelIndex);
|
2021-08-21 14:09:57 -04:00
|
|
|
void addFeatureSet();
|
|
|
|
void removeFeatureSet(unsigned int featureSetIndex);
|
2020-11-14 05:13:32 -05:00
|
|
|
void addFeature(int featureSetIndex, int selectedFeatureIndex);
|
2020-09-20 21:13:36 -04:00
|
|
|
void deleteFeature(int featureSetIndex, int featureIndex);
|
2017-12-19 19:01:53 -05:00
|
|
|
|
2020-11-11 19:22:48 -05:00
|
|
|
friend class WebAPIAdapter;
|
|
|
|
|
2017-12-17 06:08:18 -05:00
|
|
|
signals:
|
|
|
|
void finished();
|
|
|
|
|
2017-12-17 05:09:51 -05:00
|
|
|
private:
|
2020-10-08 16:33:08 -04:00
|
|
|
static MainServer *m_instance;
|
2020-10-09 02:52:30 -04:00
|
|
|
MainCore *m_mainCore;
|
2017-12-17 05:09:51 -05:00
|
|
|
DSPEngine* m_dspEngine;
|
2017-12-17 17:15:42 -05:00
|
|
|
|
|
|
|
MessageQueue m_inputMessageQueue;
|
2017-12-17 05:09:51 -05:00
|
|
|
|
|
|
|
WebAPIRequestMapper *m_requestMapper;
|
|
|
|
WebAPIServer *m_apiServer;
|
2020-10-11 06:39:30 -04:00
|
|
|
WebAPIAdapter *m_apiAdapter;
|
2017-12-17 17:15:42 -05:00
|
|
|
|
2017-12-18 07:56:10 -05:00
|
|
|
void loadSettings();
|
2019-08-13 06:18:47 -04:00
|
|
|
void applySettings();
|
2017-12-20 08:31:17 -05:00
|
|
|
void loadPresetSettings(const Preset* preset, int tabIndex);
|
2017-12-19 19:01:53 -05:00
|
|
|
void savePresetSettings(Preset* preset, int tabIndex);
|
2020-09-23 23:38:05 -04:00
|
|
|
void loadFeatureSetPresetSettings(const FeatureSetPreset* preset, int featureSetIndex);
|
|
|
|
void saveFeatureSetPresetSettings(FeatureSetPreset* preset, int featureSetIndex);
|
2017-12-18 07:56:10 -05:00
|
|
|
|
2017-12-17 17:15:42 -05:00
|
|
|
bool handleMessage(const Message& cmd);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void handleMessages();
|
2017-12-17 04:25:08 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-09 23:10:46 -04:00
|
|
|
#endif /* SDRSRV_MAINSERVER_H_ */
|