2012-05-28 21:02:45 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// 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/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef INCLUDE_OSMOSDRINPUT_H
|
|
|
|
#define INCLUDE_OSMOSDRINPUT_H
|
|
|
|
|
2013-02-12 12:59:34 +00:00
|
|
|
#include "../samplesource.h"
|
2012-05-28 21:02:45 +00:00
|
|
|
#include <osmosdr.h>
|
2012-10-29 20:42:52 +00:00
|
|
|
#include <QString>
|
2012-05-28 21:02:45 +00:00
|
|
|
|
|
|
|
class OsmoSDRThread;
|
|
|
|
|
|
|
|
class OsmoSDRInput : public SampleSource {
|
|
|
|
public:
|
2013-02-04 22:51:11 +00:00
|
|
|
struct Settings {
|
|
|
|
quint64 centerFrequency;
|
|
|
|
bool swapIQ;
|
|
|
|
int decimation;
|
|
|
|
int lnaGain;
|
|
|
|
int mixerGain;
|
|
|
|
int mixerEnhancement;
|
|
|
|
int if1gain;
|
|
|
|
int if2gain;
|
|
|
|
int if3gain;
|
|
|
|
int if4gain;
|
|
|
|
int if5gain;
|
|
|
|
int if6gain;
|
|
|
|
int opAmpI1;
|
|
|
|
int opAmpI2;
|
|
|
|
int opAmpQ1;
|
|
|
|
int opAmpQ2;
|
|
|
|
int dcOfsI;
|
|
|
|
int dcOfsQ;
|
|
|
|
|
|
|
|
Settings();
|
|
|
|
QString serialize() const;
|
|
|
|
bool deserialize(const QString& settings);
|
|
|
|
};
|
|
|
|
|
2013-02-12 12:59:34 +00:00
|
|
|
OsmoSDRInput(MessageQueue* msgQueueToGUI);
|
2012-05-28 21:02:45 +00:00
|
|
|
~OsmoSDRInput();
|
|
|
|
|
2013-02-04 22:51:11 +00:00
|
|
|
bool startInput(int device);
|
2012-05-28 21:02:45 +00:00
|
|
|
void stopInput();
|
|
|
|
|
2013-02-04 22:51:11 +00:00
|
|
|
const QString& getDeviceDescription() const;
|
|
|
|
int getSampleRate() const;
|
|
|
|
quint64 getCenterFrequency() const;
|
2012-05-31 22:19:41 +00:00
|
|
|
|
2013-02-12 12:59:34 +00:00
|
|
|
SampleSourceGUI* createGUI(MessageQueue* msgQueueToEngine, QWidget* parent = NULL) const;
|
2012-10-29 20:42:52 +00:00
|
|
|
|
2013-02-12 12:59:34 +00:00
|
|
|
void handleGUIMessage(DSPCmdGUIToSource* cmd);
|
2012-05-28 21:02:45 +00:00
|
|
|
|
|
|
|
private:
|
2013-02-04 22:51:11 +00:00
|
|
|
QMutex m_mutex;
|
|
|
|
Settings m_settings;
|
2012-05-28 21:02:45 +00:00
|
|
|
osmosdr_dev_t* m_dev;
|
|
|
|
OsmoSDRThread* m_osmoSDRThread;
|
2013-02-04 22:51:11 +00:00
|
|
|
QString m_deviceDescription;
|
|
|
|
|
|
|
|
bool applySettings(const Settings& settings, bool force);
|
|
|
|
};
|
|
|
|
|
2013-02-12 12:59:34 +00:00
|
|
|
class DSPCmdConfigureSourceOsmoSDR : public DSPCmdGUIToSource {
|
2013-02-04 22:51:11 +00:00
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
SourceType = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
int sourceType() const;
|
|
|
|
const OsmoSDRInput::Settings& getSettings() const { return m_settings; }
|
|
|
|
|
|
|
|
static DSPCmdConfigureSourceOsmoSDR* create(const OsmoSDRInput::Settings& settings)
|
|
|
|
{
|
|
|
|
return new DSPCmdConfigureSourceOsmoSDR(settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
OsmoSDRInput::Settings m_settings;
|
|
|
|
|
|
|
|
DSPCmdConfigureSourceOsmoSDR(const OsmoSDRInput::Settings& settings) : m_settings(settings) { }
|
2012-05-28 21:02:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_OSMOSDRINPUT_H
|