1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-08 17:46:03 -05:00
sdrangel/sdrsrv/mainserver.h

107 lines
3.9 KiB
C
Raw Normal View History

///////////////////////////////////////////////////////////////////////////////////
// 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 //
// (at your option) any later version. //
// //
// 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_
#include <QObject>
2017-12-17 05:09:51 -05:00
#include <QTimer>
#include "maincore.h"
2017-12-17 05:09:51 -05:00
#include "settings/mainsettings.h"
#include "util/messagequeue.h"
#include "export.h"
2020-10-09 23:10:46 -04:00
class MainParser;
class DSPEngine;
class DSPDeviceSourceEngine;
class DSPDeviceSinkEngine;
class PluginAPI;
class PluginInterface;
class ChannelMarker;
2017-12-17 17:15:42 -05:00
class DeviceSet;
class FeatureSet;
class WebAPIRequestMapper;
class WebAPIServer;
2020-10-11 06:39:30 -04:00
class WebAPIAdapter;
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 {
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; }
const QTimer& getMasterTimer() const { return m_mainCore->m_masterTimer; }
2017-12-17 05:09:51 -05:00
void addSourceDevice();
void addSinkDevice();
2020-11-10 06:15:19 -05:00
void addMIMODevice();
void removeLastDevice();
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);
void addChannel(int deviceSetIndex, int selectedChannelIndex);
void deleteChannel(int deviceSetIndex, int channelIndex);
void addFeatureSet();
void removeFeatureSet(unsigned int featureSetIndex);
2020-11-14 05:13:32 -05:00
void addFeature(int featureSetIndex, int selectedFeatureIndex);
void deleteFeature(int featureSetIndex, int featureIndex);
friend class WebAPIAdapter;
signals:
void finished();
2017-12-17 05:09:51 -05:00
private:
2020-10-08 16:33:08 -04:00
static MainServer *m_instance;
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
void loadSettings();
2019-08-13 06:18:47 -04:00
void applySettings();
void loadPresetSettings(const Preset* preset, int tabIndex);
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-17 17:15:42 -05:00
bool handleMessage(const Message& cmd);
private slots:
void handleMessages();
};
2020-10-09 23:10:46 -04:00
#endif /* SDRSRV_MAINSERVER_H_ */