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.
rtlsdrplugin.cpp
Go to the documentation of this file.
1 #include <QtPlugin>
2 #include <rtl-sdr.h>
3 
4 #include "plugin/pluginapi.h"
6 
7 #ifdef SERVER_MODE
8 #include "rtlsdrinput.h"
9 #else
10 #include "rtlsdrgui.h"
11 #endif
12 #include "rtlsdrplugin.h"
13 
15  QString("RTL-SDR Input"),
16  QString("4.5.4"),
17  QString("(c) Edouard Griffiths, F4EXB"),
18  QString("https://github.com/f4exb/sdrangel"),
19  true,
20  QString("https://github.com/f4exb/sdrangel")
21 };
22 
23 const QString RTLSDRPlugin::m_hardwareID = "RTLSDR";
25 
26 RTLSDRPlugin::RTLSDRPlugin(QObject* parent) :
27  QObject(parent)
28 {
29 }
30 
32 {
33  return m_pluginDescriptor;
34 }
35 
37 {
38  pluginAPI->registerSampleSource(m_deviceTypeID, this);
39 }
40 
42 {
43  SamplingDevices result;
44  int count = rtlsdr_get_device_count();
45  char vendor[256];
46  char product[256];
47  char serial[256];
48 
49  for(int i = 0; i < count; i++) {
50  vendor[0] = '\0';
51  product[0] = '\0';
52  serial[0] = '\0';
53 
54  if(rtlsdr_get_device_usb_strings((uint32_t)i, vendor, product, serial) != 0)
55  continue;
56  QString displayedName(QString("RTL-SDR[%1] %2").arg(i).arg(serial));
57 
58  result.append(SamplingDevice(displayedName,
61  QString(serial),
62  i,
65  1,
66  0));
67  }
68  return result;
69 }
70 
71 #ifdef SERVER_MODE
73  const QString& sourceId,
74  QWidget **widget,
75  DeviceUISet *deviceUISet)
76 {
77  (void) sourceId;
78  (void) widget;
79  (void) deviceUISet;
80  return 0;
81 }
82 #else
84  const QString& sourceId,
85  QWidget **widget,
86  DeviceUISet *deviceUISet)
87 {
88  if(sourceId == m_deviceTypeID) {
89  RTLSDRGui* gui = new RTLSDRGui(deviceUISet);
90  *widget = gui;
91  return gui;
92  } else {
93  return 0;
94  }
95 }
96 #endif
97 
99 {
100  if (sourceId == m_deviceTypeID)
101  {
102  RTLSDRInput* input = new RTLSDRInput(deviceAPI);
103  return input;
104  }
105  else
106  {
107  return 0;
108  }
109 }
110 
#define RTLSDR_DEVICE_TYPE_ID
Definition: rtlsdrplugin.h:9
RTLSDRPlugin(QObject *parent=NULL)
virtual DeviceSampleSource * createSampleSourcePluginInstance(const QString &sourceId, DeviceAPI *deviceAPI)
void registerSampleSource(const QString &sourceName, PluginInterface *plugin)
Definition: pluginapi.cpp:9
static const QString m_hardwareID
Definition: rtlsdrplugin.h:29
unsigned int uint32_t
Definition: rtptypes_win.h:46
static const PluginDescriptor m_pluginDescriptor
Definition: rtlsdrplugin.h:33
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
virtual SamplingDevices enumSampleSources()
static const QString m_deviceTypeID
Definition: rtlsdrplugin.h:30
int32_t i
Definition: decimators.h:244
void initPlugin(PluginAPI *pluginAPI)
Exposes a single input stream that can be one of the streams of a physical device.
const PluginDescriptor & getPluginDescriptor() const
virtual PluginInstanceGUI * createSampleSourcePluginInstanceGUI(const QString &sourceId, QWidget **widget, DeviceUISet *deviceUISet)
QList< SamplingDevice > SamplingDevices