Multi device support: migrate device specific stuff outside plugin classes (added files)

This commit is contained in:
f4exb 2016-05-16 01:12:55 +02:00
parent be918a217b
commit 4756299ad9
2 changed files with 171 additions and 0 deletions

View File

@ -0,0 +1,102 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
// //
// 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 "device/deviceapi.h"
DeviceAPI::DeviceAPI(DSPDeviceEngine *deviceEngine, GLSpectrum *glSpectrum) :
m_deviceEngine(deviceEngine),
m_spectrum(glSpectrum)
{
}
DeviceAPI::~DeviceAPI()
{
}
void DeviceAPI::addSink(SampleSink *sink)
{
m_deviceEngine->addSink(sink);
}
void DeviceAPI::removeSink(SampleSink* sink)
{
m_deviceEngine->removeSink(sink);
}
void DeviceAPI::addThreadedSink(ThreadedSampleSink* sink)
{
m_deviceEngine->addThreadedSink(sink);
}
void DeviceAPI::removeThreadedSink(ThreadedSampleSink* sink)
{
m_deviceEngine->removeThreadedSink(sink);
}
void DeviceAPI::setSource(SampleSource* source)
{
m_deviceEngine->setSource(source);
}
bool DeviceAPI::initAcquisition()
{
return m_deviceEngine->initAcquisition();
}
bool DeviceAPI::startAcquisition()
{
return m_deviceEngine->startAcquisition();
}
void DeviceAPI::stopAcquisition()
{
m_deviceEngine->stopAcquistion();
}
DSPDeviceEngine::State DeviceAPI::state() const
{
return m_deviceEngine->state();
}
QString DeviceAPI::errorMessage()
{
return m_deviceEngine->errorMessage();
}
uint DeviceAPI::getDeviceUID() const
{
return m_deviceEngine->getUID();
}
MessageQueue *DeviceAPI::getDeviceInputMessageQueue()
{
return m_deviceEngine->getInputMessageQueue();
}
MessageQueue *DeviceAPI::getDeviceOutputMessageQueue()
{
return m_deviceEngine->getOutputMessageQueue();
}
void DeviceAPI::configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection)
{
m_deviceEngine->configureCorrections(dcOffsetCorrection, iqImbalanceCorrection);
}
GLSpectrum *DeviceAPI::getSpectrum()
{
return m_spectrum;
}

View File

@ -0,0 +1,69 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
// //
// 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_DEVICE_DEVICEAPI_H_
#define SDRBASE_DEVICE_DEVICEAPI_H_
#include <QObject>
#include <QString>
#include "util/export.h"
#include "dsp/dspdeviceengine.h"
class MainWindow;
class DSPDeviceEngine;
class GLSpectrum;
class SampleSink;
class ThreadedSampleSink;
class SampleSource;
class MessageQueue;
class SDRANGEL_API DeviceAPI : public QObject {
Q_OBJECT
public:
// Device engine stuff
void addSink(SampleSink* sink); //!< Add a sample sink to device engine
void removeSink(SampleSink* sink); //!< Remove a sample sink from device engine
void addThreadedSink(ThreadedSampleSink* sink); //!< Add a sample sink that will run on its own thread to device engine
void removeThreadedSink(ThreadedSampleSink* sink); //!< Remove a sample sink that runs on its own thread from device engine
void setSource(SampleSource* source); //!< Set device engine sample source type
bool initAcquisition(); //!< Initialize device engine acquisition sequence
bool startAcquisition(); //!< Start device engine acquisition sequence
void stopAcquisition(); //!< Stop device engine acquisition sequence
DSPDeviceEngine::State state() const; //!< device engine state
QString errorMessage(); //!< Return the current device engine error message
uint getDeviceUID() const; //!< Return the current device engine unique ID
MessageQueue *getDeviceInputMessageQueue();
MessageQueue *getDeviceOutputMessageQueue();
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection); //!< Configure current device engine DSP corrections
// device related stuff
GLSpectrum *getSpectrum();
protected:
DeviceAPI(DSPDeviceEngine *deviceEngine, GLSpectrum *glSpectrum);
~DeviceAPI();
DSPDeviceEngine *m_deviceEngine;
GLSpectrum *m_spectrum;
friend class MainWindow;
};
#endif /* SDRBASE_DEVICE_DEVICEAPI_H_ */