sdrangel/sdrsrv/maincore.h

114 wiersze
3.5 KiB
C
Czysty Zwykły widok Historia

///////////////////////////////////////////////////////////////////////////////////
// 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 //
// //
// 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/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRSRV_MAINCORE_H_
#define SDRSRV_MAINCORE_H_
#include <QObject>
2017-12-17 10:09:51 +00:00
#include <QTimer>
#include "settings/mainsettings.h"
#include "util/message.h"
#include "util/messagequeue.h"
#include "util/export.h"
2017-12-17 10:09:51 +00:00
#include "mainparser.h"
class AudioDeviceInfo;
class DSPEngine;
class DSPDeviceSourceEngine;
class DSPDeviceSinkEngine;
class DeviceSourceAPI;
class DeviceSinkAPI;
class PluginAPI;
class PluginInterface;
class PluginManager;
class ChannelMarker;
2017-12-17 22:15:42 +00:00
class DeviceSet;
class WebAPIRequestMapper;
class WebAPIServer;
2017-12-17 22:15:42 +00:00
class WebAPIAdapterSrv;
2017-12-17 10:09:51 +00:00
namespace qtwebapp {
class LoggerWithFile;
}
class SDRANGEL_API MainCore : public QObject {
Q_OBJECT
2017-12-17 10:09:51 +00:00
public:
explicit MainCore(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QObject *parent = 0);
2017-12-17 10:09:51 +00:00
~MainCore();
static MainCore *getInstance() { return m_instance; } // Main Core is de facto a singleton so this just returns its reference
MessageQueue* getInputMessageQueue() { return &m_inputMessageQueue; }
const QTimer& getMasterTimer() const { return m_masterTimer; }
const MainSettings& getMainSettings() const { return m_settings; }
friend class WebAPIAdapterSrv;
signals:
void finished();
2017-12-17 10:09:51 +00:00
private:
2017-12-17 22:15:42 +00:00
class MsgDeleteInstance : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgDeleteInstance* create()
{
return new MsgDeleteInstance();
}
private:
MsgDeleteInstance() :
Message()
{ }
};
2017-12-17 10:09:51 +00:00
static MainCore *m_instance;
MainSettings m_settings;
int m_masterTabIndex;
DSPEngine* m_dspEngine;
int m_lastEngineState;
qtwebapp::LoggerWithFile *m_logger;
2017-12-17 22:15:42 +00:00
MessageQueue m_inputMessageQueue;
QTimer m_masterTimer;
std::vector<DeviceSet*> m_deviceSets;
PluginManager* m_pluginManager;
AudioDeviceInfo m_audioDeviceInfo;
2017-12-17 10:09:51 +00:00
WebAPIRequestMapper *m_requestMapper;
WebAPIServer *m_apiServer;
WebAPIAdapterSrv *m_apiAdapter;
2017-12-17 22:15:42 +00:00
void loadSettings();
void setLoggingOptions();
2017-12-17 22:15:42 +00:00
bool handleMessage(const Message& cmd);
private slots:
void handleMessages();
};
#endif /* SDRSRV_MAINCORE_H_ */