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.
xtrxoutputplugin.cpp
Go to the documentation of this file.
1 // Copyright (C) 2019 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 <regex>
21 #include <string>
22 
23 #include "xtrx_api.h"
24 #include "plugin/pluginapi.h"
25 #include "util/simpleserializer.h"
26 #include "xtrx/devicextrxparam.h"
27 
28 #ifdef SERVER_MODE
29 #include "xtrxoutput.h"
30 #else
31 #include "xtrxoutputgui.h"
32 #endif
33 #include "../xtrxoutput/xtrxoutputplugin.h"
34 
36  QString("XTRX Output"),
37  QString("4.5.4"),
38  QString("(c) Edouard Griffiths, F4EXB"),
39  QString("https://github.com/f4exb/sdrangel"),
40  true,
41  QString("https://github.com/f4exb/sdrangel")
42 };
43 
44 const QString XTRXOutputPlugin::m_hardwareID = "XTRX";
46 
48  QObject(parent)
49 {
50 }
51 
53 {
54  return m_pluginDescriptor;
55 }
56 
58 {
59  pluginAPI->registerSampleSink(m_deviceTypeID, this);
60 }
61 
63 {
64  SamplingDevices result;
65  xtrx_device_info_t devs[32];
66  int res = xtrx_discovery(devs, 32);
67  int i;
68  for (i = 0; i < res; i++) {
69  DeviceXTRXParams XTRXParams;
70  for (unsigned int j = 0; j < XTRXParams.m_nbTxChannels; j++)
71  {
72  qDebug("XTRXInputPlugin::enumSampleSinks: device #%d channel %u: %s", i, j, devs[i].uniqname);
73  QString displayedName(QString("XTRX[%1:%2] %3").arg(i).arg(j).arg(devs[i].uniqname));
74  result.append(SamplingDevice(displayedName,
77  QString(devs[i].uniqname),
78  i,
81  XTRXParams.m_nbTxChannels,
82  j));
83  }
84  }
85  return result;
86 }
87 
88 #ifdef SERVER_MODE
90  const QString& sinkId,
91  QWidget **widget,
92  DeviceUISet *deviceUISet)
93 {
94  (void) sinkId;
95  (void) widget;
96  (void) deviceUISet;
97  return 0;
98 }
99 #else
101  const QString& sinkId,
102  QWidget **widget,
103  DeviceUISet *deviceUISet)
104 {
105  if(sinkId == m_deviceTypeID)
106  {
107  XTRXOutputGUI* gui = new XTRXOutputGUI(deviceUISet);
108  *widget = gui;
109  return gui;
110  }
111  else
112  {
113  return 0;
114  }
115 }
116 #endif
117 
119 {
120  if(sinkId == m_deviceTypeID)
121  {
122  XTRXOutput* output = new XTRXOutput(deviceAPI);
123  return output;
124  }
125  else
126  {
127  return 0;
128  }
129 }
130 
static const QString m_deviceTypeID
void registerSampleSink(const QString &sinkName, PluginInterface *plugin)
Definition: pluginapi.cpp:24
uint32_t m_nbTxChannels
number of Tx channels
virtual SamplingDevices enumSampleSinks()
void initPlugin(PluginAPI *pluginAPI)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
XTRXOutputPlugin(QObject *parent=0)
int32_t i
Definition: decimators.h:244
virtual PluginInstanceGUI * createSampleSinkPluginInstanceGUI(const QString &sinkId, QWidget **widget, DeviceUISet *deviceUISet)
Exposes a single output stream that can be one of the streams of a physical device.
const PluginDescriptor & getPluginDescriptor() const
static const QString m_hardwareID
#define XTRXOUTPUT_DEVICE_TYPE_ID
static const PluginDescriptor m_pluginDescriptor
QList< SamplingDevice > SamplingDevices
virtual DeviceSampleSink * createSampleSinkPluginInstance(const QString &sinkId, DeviceAPI *deviceAPI)