mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-21 04:58:38 -05:00
RxTx semantic move: created DeviceSampleSource class
This commit is contained in:
parent
7a535cc3b8
commit
c8f4147f31
40
sdrbase/dsp/devicesamplesource.cpp
Normal file
40
sdrbase/dsp/devicesamplesource.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||||
|
// written by Christian Daniel //
|
||||||
|
// //
|
||||||
|
// 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/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <dsp/devicesamplesource.h>
|
||||||
|
|
||||||
|
DeviceSampleSource::DeviceSampleSource()
|
||||||
|
{
|
||||||
|
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceSampleSource::~DeviceSampleSource()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceSampleSource::handleInputMessages()
|
||||||
|
{
|
||||||
|
Message* message;
|
||||||
|
|
||||||
|
while ((message = m_inputMessageQueue.pop()) != 0)
|
||||||
|
{
|
||||||
|
if (handleMessage(*message))
|
||||||
|
{
|
||||||
|
delete message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
56
sdrbase/dsp/devicesamplesource.h
Normal file
56
sdrbase/dsp/devicesamplesource.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2015 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 INCLUDE_SAMPLESOURCE_H
|
||||||
|
#define INCLUDE_SAMPLESOURCE_H
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include "dsp/samplefifo.h"
|
||||||
|
#include "util/message.h"
|
||||||
|
#include "util/messagequeue.h"
|
||||||
|
#include "util/export.h"
|
||||||
|
|
||||||
|
class SDRANGEL_API DeviceSampleSource : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DeviceSampleSource();
|
||||||
|
virtual ~DeviceSampleSource();
|
||||||
|
|
||||||
|
virtual bool init(const Message& cmd) = 0;
|
||||||
|
virtual bool start(int device) = 0;
|
||||||
|
virtual void stop() = 0;
|
||||||
|
|
||||||
|
virtual const QString& getDeviceDescription() const = 0;
|
||||||
|
virtual int getSampleRate() const = 0; //!< Sample rate exposed by the source
|
||||||
|
virtual quint64 getCenterFrequency() const = 0; //!< Center frequency exposed by the source
|
||||||
|
|
||||||
|
virtual bool handleMessage(const Message& message) = 0;
|
||||||
|
|
||||||
|
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||||
|
MessageQueue *getOutputMessageQueueToGUI() { return &m_outputMessageQueueToGUI; }
|
||||||
|
SampleFifo* getSampleFifo() { return &m_sampleFifo; }
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void handleInputMessages();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SampleFifo m_sampleFifo;
|
||||||
|
MessageQueue m_inputMessageQueue; //!< Input queue to the source
|
||||||
|
MessageQueue m_outputMessageQueueToGUI; //!< Output queue specialized for the source GUI
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INCLUDE_SAMPLESOURCE_H
|
Loading…
Reference in New Issue
Block a user