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.
plutosdroutputplugin.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 "plutosdroutput.h"
25 #else
26 #include "plutosdroutputgui.h"
27 #endif
28 #include "plutosdroutputplugin.h"
29 
31  QString("PlutoSDR Output"),
32  QString("4.5.4"),
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 PlutoSDROutputPlugin::m_hardwareID = "PlutoSDR";
41 
43  QObject(parent)
44 {
45 }
46 
48 {
49  return m_pluginDescriptor;
50 }
51 
53 {
54  pluginAPI->registerSampleSink(m_deviceTypeID, this);
55  DevicePlutoSDR::instance(); // create singleton
56 }
57 
59 {
61  std::vector<std::string> serials;
63 
64  std::vector<std::string>::const_iterator it = serials.begin();
65  int i;
66  SamplingDevices result;
67 
68  for (i = 0; it != serials.end(); ++it, ++i)
69  {
70  QString serial_str = QString::fromLocal8Bit(it->c_str());
71  QString displayedName(QString("PlutoSDR[%1] %2").arg(i).arg(serial_str));
72 
73  result.append(SamplingDevice(displayedName,
76  serial_str,
77  i,
80  1,
81  0));
82 
83  qDebug("PlutoSDROutputPlugin::enumSampleSources: enumerated PlutoSDR device #%d", i);
84  }
85 
86  return result;
87 }
88 
89 #ifdef SERVER_MODE
91  const QString& sinkId,
92  QWidget **widget,
93  DeviceUISet *deviceUISet)
94 {
95  (void) sinkId;
96  (void) widget;
97  (void) deviceUISet;
98  return 0;
99 }
100 #else
102  const QString& sinkId,
103  QWidget **widget,
104  DeviceUISet *deviceUISet)
105 {
106  if(sinkId == m_deviceTypeID)
107  {
108  PlutoSDROutputGUI* gui = new PlutoSDROutputGUI(deviceUISet);
109  *widget = gui;
110  return gui;
111  }
112  else
113  {
114  return 0;
115  }
116 }
117 #endif
118 
120 {
121  if (sinkId == m_deviceTypeID)
122  {
123  PlutoSDROutput* output = new PlutoSDROutput(deviceAPI);
124  return output;
125  }
126  else
127  {
128  return 0;
129  }
130 }
131 
static const QString m_hardwareID
void registerSampleSink(const QString &sinkName, PluginInterface *plugin)
Definition: pluginapi.cpp:24
virtual DeviceSampleSink * createSampleSinkPluginInstance(const QString &sinkId, DeviceAPI *deviceAPI)
static DevicePlutoSDR & instance()
static const PluginDescriptor m_pluginDescriptor
static const QString m_deviceTypeID
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)
Exposes a single output stream that can be one of the streams of a physical device.
virtual PluginInstanceGUI * createSampleSinkPluginInstanceGUI(const QString &sinkId, QWidget **widget, DeviceUISet *deviceUISet)
const PluginDescriptor & getPluginDescriptor() const
PlutoSDROutputPlugin(QObject *parent=NULL)
#define PLUTOSDR_DEVICE_TYPE_ID
virtual SamplingDevices enumSampleSinks()
QList< SamplingDevice > SamplingDevices