SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
testsourceplugin.cpp
Go to the documentation of this file.
1 // Copyright (C) 2018 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #include <QtPlugin>
19 
20 #include "plugin/pluginapi.h"
21 #include "util/simpleserializer.h"
22 
23 #ifdef SERVER_MODE
24 #include "testsourceinput.h"
25 #else
26 #include "testsourcegui.h"
27 #endif
28 #include "testsourceplugin.h"
29 
31  QString("Test Source input"),
32  QString("4.5.2"),
33  QString("(c) Edouard Griffiths, F4EXB"),
34  QString("https://github.com/f4exb/sdrangel"),
35  true,
36  QString("https://github.com/f4exb/sdrangel")
37 };
38 
39 const QString TestSourcePlugin::m_hardwareID = "TestSource";
41 
43  QObject(parent)
44 {
45 }
46 
48 {
49  return m_pluginDescriptor;
50 }
51 
53 {
54  pluginAPI->registerSampleSource(m_deviceTypeID, this);
55 }
56 
58 {
59  SamplingDevices result;
60 
61  result.append(SamplingDevice(
62  "TestSource",
65  QString::null,
66  0,
69  1,
70  0));
71 
72  return result;
73 }
74 
75 #ifdef SERVER_MODE
77  const QString& sourceId,
78  QWidget **widget,
79  DeviceUISet *deviceUISet)
80 {
81  (void) sourceId;
82  (void) widget;
83  (void) deviceUISet;
84  return 0;
85 }
86 #else
88  const QString& sourceId,
89  QWidget **widget,
90  DeviceUISet *deviceUISet)
91 {
92  if(sourceId == m_deviceTypeID) {
93  TestSourceGui* gui = new TestSourceGui(deviceUISet);
94  *widget = gui;
95  return gui;
96  } else {
97  return 0;
98  }
99 }
100 #endif
101 
103 {
104  if (sourceId == m_deviceTypeID)
105  {
106  TestSourceInput* input = new TestSourceInput(deviceAPI);
107  return input;
108  }
109  else
110  {
111  return 0;
112  }
113 }
114 
void initPlugin(PluginAPI *pluginAPI)
virtual PluginInstanceGUI * createSampleSourcePluginInstanceGUI(const QString &sourceId, QWidget **widget, DeviceUISet *deviceUISet)
static const QString m_deviceTypeID
TestSourcePlugin(QObject *parent=NULL)
void registerSampleSource(const QString &sourceName, PluginInterface *plugin)
Definition: pluginapi.cpp:9
static const QString m_hardwareID
virtual DeviceSampleSource * createSampleSourcePluginInstance(const QString &sourceId, DeviceAPI *deviceAPI)
static const PluginDescriptor m_pluginDescriptor
Exposes a single input stream that can be one of the streams of a physical device.
virtual SamplingDevices enumSampleSources()
#define TESTSOURCE_DEVICE_TYPE_ID
const PluginDescriptor & getPluginDescriptor() const
QList< SamplingDevice > SamplingDevices