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.
sdrplayplugin.cpp
Go to the documentation of this file.
1 // Copyright (C) 2016 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 #include <mirisdr.h>
20 #include "plugin/pluginapi.h"
21 #include "util/simpleserializer.h"
22 
23 #ifdef SERVER_MODE
24 #include "sdrplayinput.h"
25 #else
26 #include "sdrplaygui.h"
27 #endif
28 #include "sdrplayplugin.h"
29 
31  QString("SDRPlay RSP1 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 SDRPlayPlugin::m_hardwareID = "SDRplay1";
41 
42 SDRPlayPlugin::SDRPlayPlugin(QObject* parent) :
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  int count = mirisdr_get_device_count();
61 
62  char vendor[256];
63  char product[256];
64  char serial[256];
65 
66  for(int i = 0; i < count; i++)
67  {
68  vendor[0] = '\0';
69  product[0] = '\0';
70  serial[0] = '\0';
71 
72  if (mirisdr_get_device_usb_strings((uint32_t)i, vendor, product, serial) != 0)
73  {
74  continue;
75  }
76 
77  qDebug("SDRPlayPlugin::enumSampleSources: found %s:%s (%s)", vendor, product, serial);
78  QString displayedName(QString("SDRPlay[%1] %2").arg(i).arg(serial));
79 
80  result.append(SamplingDevice(displayedName,
83  QString(serial),
84  i,
87  1,
88  0));
89  }
90 
91  return result;
92 }
93 
94 #ifdef SERVER_MODE
96  const QString& sourceId,
97  QWidget **widget,
98  DeviceUISet *deviceUISet)
99 {
100  (void) sourceId;
101  (void) widget;
102  (void) deviceUISet;
103  return 0;
104 }
105 #else
107  const QString& sourceId,
108  QWidget **widget,
109  DeviceUISet *deviceUISet)
110 {
111  if(sourceId == m_deviceTypeID)
112  {
113  SDRPlayGui* gui = new SDRPlayGui(deviceUISet);
114  *widget = gui;
115  return gui;
116  }
117  else
118  {
119  return 0;
120  }
121 }
122 #endif
123 
125 {
126  if (sourceId == m_deviceTypeID)
127  {
128  SDRPlayInput* input = new SDRPlayInput(deviceAPI);
129  return input;
130  }
131  else
132  {
133  return 0;
134  }
135 }
136 
static const PluginDescriptor m_pluginDescriptor
Definition: sdrplayplugin.h:50
void registerSampleSource(const QString &sourceName, PluginInterface *plugin)
Definition: pluginapi.cpp:9
SDRPlayPlugin(QObject *parent=NULL)
const PluginDescriptor & getPluginDescriptor() const
virtual PluginInstanceGUI * createSampleSourcePluginInstanceGUI(const QString &sourceId, QWidget **widget, DeviceUISet *deviceUISet)
unsigned int uint32_t
Definition: rtptypes_win.h:46
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
virtual SamplingDevices enumSampleSources()
int32_t i
Definition: decimators.h:244
virtual DeviceSampleSource * createSampleSourcePluginInstance(const QString &sourceId, DeviceAPI *deviceAPI)
Exposes a single input stream that can be one of the streams of a physical device.
static const QString m_deviceTypeID
Definition: sdrplayplugin.h:47
void initPlugin(PluginAPI *pluginAPI)
#define SDRPLAY_DEVICE_TYPE_ID
Definition: sdrplayplugin.h:26
static const QString m_hardwareID
Definition: sdrplayplugin.h:46
QList< SamplingDevice > SamplingDevices