2017-09-16 09:34:25 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2016 F4EXB //
|
|
|
|
// written by Edouard Griffiths //
|
|
|
|
// //
|
|
|
|
// 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 SDRBASE_DSP_DEVICESAMPLESINK_H_
|
|
|
|
#define SDRBASE_DSP_DEVICESAMPLESINK_H_
|
|
|
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
|
|
|
#include "samplesourcefifo.h"
|
|
|
|
#include "util/message.h"
|
|
|
|
#include "util/messagequeue.h"
|
2018-03-20 12:49:21 +00:00
|
|
|
#include "export.h"
|
2017-09-16 09:34:25 +00:00
|
|
|
|
2017-12-04 22:07:30 +00:00
|
|
|
namespace SWGSDRangel
|
|
|
|
{
|
2017-12-06 18:23:42 +00:00
|
|
|
class SWGDeviceSettings;
|
2017-12-08 16:12:33 +00:00
|
|
|
class SWGDeviceState;
|
2018-05-25 23:43:28 +00:00
|
|
|
class SWGDeviceReport;
|
2017-12-04 22:07:30 +00:00
|
|
|
}
|
|
|
|
|
2018-03-03 19:23:38 +00:00
|
|
|
class SDRBASE_API DeviceSampleSink : public QObject {
|
2017-09-16 09:34:25 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DeviceSampleSink();
|
|
|
|
virtual ~DeviceSampleSink();
|
|
|
|
virtual void destroy() = 0;
|
|
|
|
|
2017-12-25 11:59:44 +00:00
|
|
|
virtual void init() = 0; //!< initializations to be done when all collaborating objects are created and possibly connected
|
2017-09-16 09:34:25 +00:00
|
|
|
virtual bool start() = 0;
|
|
|
|
virtual void stop() = 0;
|
|
|
|
|
2017-12-28 03:04:50 +00:00
|
|
|
virtual QByteArray serialize() const = 0;
|
|
|
|
virtual bool deserialize(const QByteArray& data) = 0;
|
|
|
|
|
2017-09-16 09:34:25 +00:00
|
|
|
virtual const QString& getDeviceDescription() const = 0;
|
|
|
|
virtual int getSampleRate() const = 0; //!< Sample rate exposed by the sink
|
|
|
|
virtual quint64 getCenterFrequency() const = 0; //!< Center frequency exposed by the sink
|
2017-12-28 03:04:50 +00:00
|
|
|
virtual void setCenterFrequency(qint64 centerFrequency) = 0;
|
2017-09-16 09:34:25 +00:00
|
|
|
|
|
|
|
virtual bool handleMessage(const Message& message) = 0;
|
|
|
|
|
2017-12-04 17:22:25 +00:00
|
|
|
virtual int webapiSettingsGet(
|
2017-12-06 18:23:42 +00:00
|
|
|
SWGSDRangel::SWGDeviceSettings& response __attribute__((unused)),
|
2017-12-04 17:22:25 +00:00
|
|
|
QString& errorMessage)
|
|
|
|
{ errorMessage = "Not implemented"; return 501; }
|
|
|
|
|
2017-12-07 12:55:42 +00:00
|
|
|
virtual int webapiSettingsPutPatch(
|
|
|
|
bool force __attribute__((unused)), //!< true to force settings = put
|
2017-12-27 00:46:33 +00:00
|
|
|
const QStringList& deviceSettingsKeys __attribute__((unused)),
|
2017-12-07 12:55:42 +00:00
|
|
|
SWGSDRangel::SWGDeviceSettings& response __attribute__((unused)),
|
|
|
|
QString& errorMessage)
|
|
|
|
{ errorMessage = "Not implemented"; return 501; }
|
|
|
|
|
2017-12-09 09:49:20 +00:00
|
|
|
virtual int webapiRunGet(
|
|
|
|
SWGSDRangel::SWGDeviceState& response __attribute__((unused)),
|
|
|
|
QString& errorMessage)
|
|
|
|
{ errorMessage = "Not implemented"; return 501; }
|
|
|
|
|
2017-12-08 16:12:33 +00:00
|
|
|
virtual int webapiRun(bool run __attribute__((unused)),
|
|
|
|
SWGSDRangel::SWGDeviceState& response __attribute__((unused)),
|
|
|
|
QString& errorMessage)
|
|
|
|
{ errorMessage = "Not implemented"; return 501; }
|
|
|
|
|
2018-05-25 23:43:28 +00:00
|
|
|
virtual int webapiReportGet(
|
|
|
|
SWGSDRangel::SWGDeviceReport& response __attribute__((unused)),
|
|
|
|
QString& errorMessage)
|
|
|
|
{ errorMessage = "Not implemented"; return 501; }
|
|
|
|
|
2017-09-16 09:34:25 +00:00
|
|
|
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
2017-12-24 18:58:26 +00:00
|
|
|
virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this
|
2017-09-16 21:44:00 +00:00
|
|
|
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
|
2017-09-16 09:34:25 +00:00
|
|
|
SampleSourceFifo* getSampleFifo() { return &m_sampleSourceFifo; }
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void handleInputMessages();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
SampleSourceFifo m_sampleSourceFifo;
|
|
|
|
MessageQueue m_inputMessageQueue; //!< Input queue to the sink
|
2017-09-16 21:44:00 +00:00
|
|
|
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
|
2017-09-16 09:34:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* SDRBASE_DSP_DEVICESAMPLESINK_H_ */
|