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.
plutosdrinputplugin.cpp
Go to the documentation of this file.
1 // Copyright (C) 2017 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"
22 
23 #ifdef SERVER_MODE
24 #include "plutosdrinput.h"
25 #else
26 #include "plutosdrinputgui.h"
27 #endif
28 #include "plutosdrinputplugin.h"
29 
30 class DeviceAPI;
31 
33  QString("PlutoSDR Input"),
34  QString("4.11.3"),
35  QString("(c) Edouard Griffiths, F4EXB"),
36  QString("https://github.com/f4exb/sdrangel"),
37  true,
38  QString("https://github.com/f4exb/sdrangel")
39 };
40 
41 const QString PlutoSDRInputPlugin::m_hardwareID = "PlutoSDR";
43 
45  QObject(parent)
46 {
47 }
48 
50 {
51  return m_pluginDescriptor;
52 }
53 
55 {
56  pluginAPI->registerSampleSource(m_deviceTypeID, this);
57  DevicePlutoSDR::instance(); // create singleton
58 }
59 
61 {
63  std::vector<std::string> serials;
65 
66  std::vector<std::string>::const_iterator it = serials.begin();
67  int i;
68  SamplingDevices result;
69 
70  for (i = 0; it != serials.end(); ++it, ++i)
71  {
72  QString serial_str = QString::fromLocal8Bit(it->c_str());
73  QString displayedName(QString("PlutoSDR[%1] %2").arg(i).arg(serial_str));
74 
75  result.append(SamplingDevice(displayedName,
78  serial_str,
79  i,
82  1,
83  0));
84 
85  qDebug("PlutoSDRInputPlugin::enumSampleSources: enumerated PlutoSDR device #%d", i);
86  }
87 
88  return result;
89 }
90 
91 #ifdef SERVER_MODE
93  const QString& sourceId,
94  QWidget **widget,
95  DeviceUISet *deviceUISet)
96 {
97  (void) sourceId;
98  (void) widget;
99  (void) deviceUISet;
100  return 0;
101 }
102 #else
104  const QString& sourceId,
105  QWidget **widget,
106  DeviceUISet *deviceUISet)
107 {
108  if(sourceId == m_deviceTypeID)
109  {
110  PlutoSDRInputGui* gui = new PlutoSDRInputGui(deviceUISet);
111  *widget = gui;
112  return gui;
113  }
114  else
115  {
116  return 0;
117  }
118 }
119 #endif
120 
122 {
123  if (sourceId == m_deviceTypeID)
124  {
125  PlutoSDRInput* input = new PlutoSDRInput(deviceAPI);
126  return input;
127  }
128  else
129  {
130  return 0;
131  }
132 }
133 
virtual PluginInstanceGUI * createSampleSourcePluginInstanceGUI(const QString &sourceId, QWidget **widget, DeviceUISet *deviceUISet)
void registerSampleSource(const QString &sourceName, PluginInterface *plugin)
Definition: pluginapi.cpp:9
static DevicePlutoSDR & instance()
const PluginDescriptor & getPluginDescriptor() const
virtual SamplingDevices enumSampleSources()
virtual DeviceSampleSource * createSampleSourcePluginInstance(const QString &sourceId, DeviceAPI *deviceAPI)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
void getSerials(std::vector< std::string > &serials) const
int32_t i
Definition: decimators.h:244
void initPlugin(PluginAPI *pluginAPI)
PlutoSDRInputPlugin(QObject *parent=NULL)
static const QString m_hardwareID
Exposes a single input stream that can be one of the streams of a physical device.
static const PluginDescriptor m_pluginDescriptor
static const QString m_deviceTypeID
#define PLUTOSDR_DEVICE_TYPE_ID
QList< SamplingDevice > SamplingDevices