summaryrefslogtreecommitdiffstats
path: root/plugins/samplesource/gnuradio/gnuradioplugin.cpp
blob: 8ad2180871b6ce3c4d79c8f34fe61b6e774b4d09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <QtPlugin>
#include <QAction>
#include "plugin/pluginapi.h"
#include "util/simpleserializer.h"
#include "gnuradioplugin.h"
#include "gnuradiogui.h"

const PluginDescriptor GNURadioPlugin::m_pluginDescriptor = {
	QString("GR-OsmoSDR Input"),
	QString("1.0"),
	QString("(c) Dimitri Stolnikov <horiz0n@gmx.net>"),
	QString("http://sdr.osmocom.org/trac/wiki/GrOsmoSDR"),
	true,
	QString("http://cgit.osmocom.org/cgit/gr-osmosdr")
};

GNURadioPlugin::GNURadioPlugin(QObject* parent) :
	QObject(parent)
{
}

const PluginDescriptor& GNURadioPlugin::getPluginDescriptor() const
{
	return m_pluginDescriptor;
}

void GNURadioPlugin::initPlugin(PluginAPI* pluginAPI)
{
	m_pluginAPI = pluginAPI;

	m_pluginAPI->registerSampleSource("org.osmocom.sdr.samplesource.gr-osmosdr", this);
}

PluginInterface::SampleSourceDevices GNURadioPlugin::enumSampleSources()
{
	SampleSourceDevices result;

	result.append(SampleSourceDevice("GNURadio OsmoSDR Driver", "org.osmocom.sdr.samplesource.gr-osmosdr", QByteArray()));

	return result;
}

PluginGUI* GNURadioPlugin::createSampleSource(const QString& sourceName, const QByteArray& address)
{
	if(sourceName == "org.osmocom.sdr.samplesource.gr-osmosdr") {
		GNURadioGui* gui = new GNURadioGui(m_pluginAPI);
		m_pluginAPI->setInputGUI(gui);
		return gui;
	} else {
		return NULL;
	}
}