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.
xtrxinputplugin.cpp
Go to the documentation of this file.
1 // Copyright (C) 2017, 2018 Edouard Griffiths, F4EXB //
3 // Copyright (C) 2017 Sergey Kostanbaev, Fairwaves Inc. //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // This program is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #include "xtrxinputplugin.h"
20 
21 #include <QtPlugin>
22 
23 #include <regex>
24 #include <string>
25 
26 #include "xtrx_api.h"
27 #include "plugin/pluginapi.h"
28 #include "util/simpleserializer.h"
29 
30 #ifdef SERVER_MODE
31 #include "xtrxinput.h"
32 #else
33 #include "xtrxinputgui.h"
34 #endif
35 
37  QString("XTRX Input"),
38  QString("4.5.4"),
39  QString("(c) Edouard Griffiths, F4EXB"),
40  QString("https://github.com/f4exb/sdrangel"),
41  true,
42  QString("https://github.com/f4exb/sdrangel")
43 };
44 
45 const QString XTRXInputPlugin::m_hardwareID = "XTRX";
47 
49  QObject(parent)
50 {
51 }
52 
54 {
55  return m_pluginDescriptor;
56 }
57 
59 {
60  pluginAPI->registerSampleSource(m_deviceTypeID, this);
61 }
62 
64 {
65  SamplingDevices result;
66  xtrx_device_info_t devs[32];
67  int res = xtrx_discovery(devs, 32);
68  int i;
69  for (i = 0; i < res; i++) {
70  DeviceXTRXParams XTRXParams;
71  for (unsigned int j = 0; j < XTRXParams.m_nbRxChannels; j++)
72  {
73  qDebug("XTRXInputPlugin::enumSampleSources: device #%d channel %u: %s", i, j, devs[i].uniqname);
74  QString displayedName(QString("XTRX[%1:%2] %3").arg(i).arg(j).arg(devs[i].uniqname));
75  result.append(SamplingDevice(displayedName,
78  QString(devs[i].uniqname),
79  i,
82  XTRXParams.m_nbRxChannels,
83  j));
84  }
85  }
86  return result;
87 }
88 
89 #ifdef SERVER_MODE
91  const QString& sourceId,
92  QWidget **widget,
93  DeviceUISet *deviceUISet)
94 {
95  (void) sourceId;
96  (void) widget;
97  (void) deviceUISet;
98  return 0;
99 }
100 #else
102  const QString& sourceId,
103  QWidget **widget,
104  DeviceUISet *deviceUISet)
105 {
106  if(sourceId == m_deviceTypeID)
107  {
108  XTRXInputGUI* gui = new XTRXInputGUI(deviceUISet);
109  *widget = gui;
110  return gui;
111  }
112  else
113  {
114  return 0;
115  }
116 }
117 #endif
118 
120 {
121  if (sourceId == m_deviceTypeID)
122  {
123  XTRXInput* input = new XTRXInput(deviceAPI);
124  return input;
125  }
126  else
127  {
128  return 0;
129  }
130 }
static const QString m_hardwareID
static const QString m_deviceTypeID
static const PluginDescriptor m_pluginDescriptor
void registerSampleSource(const QString &sourceName, PluginInterface *plugin)
Definition: pluginapi.cpp:9
uint32_t m_nbRxChannels
number of Rx channels
virtual SamplingDevices enumSampleSources()
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
void initPlugin(PluginAPI *pluginAPI)
int32_t i
Definition: decimators.h:244
Exposes a single input stream that can be one of the streams of a physical device.
#define XTRX_DEVICE_TYPE_ID
virtual DeviceSampleSource * createSampleSourcePluginInstance(const QString &sourceId, DeviceAPI *deviceAPI)
XTRXInputPlugin(QObject *parent=0)
virtual PluginInstanceGUI * createSampleSourcePluginInstanceGUI(const QString &sourceId, QWidget **widget, DeviceUISet *deviceUISet)
const PluginDescriptor & getPluginDescriptor() const
QList< SamplingDevice > SamplingDevices