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.
perseusplugin.cpp
Go to the documentation of this file.
1 // Copyright (C) 2018 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 "perseus-sdr.h"
20 
21 #include "plugin/pluginapi.h"
22 #include "util/simpleserializer.h"
23 #include "perseus/deviceperseus.h"
24 #include "perseusplugin.h"
25 
26 #ifdef SERVER_MODE
27 #include "perseusinput.h"
28 #else
29 #include "perseusgui.h"
30 #endif
31 
33  QString("Perseus Input"),
34  QString("4.5.2"),
35  QString("(c) Edouard Griffiths, F4EXB"),
36  QString("https://github.com/f4exb/sdrangel"),
37  true,
38  QString("https://github.com/f4exb/sdrangel")
39 };
40 
41 const QString PerseusPlugin::m_hardwareID = "Perseus";
43 const int PerseusPlugin::m_maxDevices = 32;
44 
45 PerseusPlugin::PerseusPlugin(QObject* parent) :
46  QObject(parent)
47 {
48 }
49 
51 {
52  return m_pluginDescriptor;
53 }
54 
56 {
57  pluginAPI->registerSampleSource(m_deviceTypeID, this);
58 }
59 
61 {
63  std::vector<std::string> serials;
65 
66  std::vector<std::string>::const_iterator it = serials.begin();
67  int i;
68  SamplingDevices result;
69 
70  for (i = 0; it != serials.end(); ++it, ++i)
71  {
72  QString serial_str = QString::fromLocal8Bit(it->c_str());
73  QString displayedName(QString("Perseus[%1] %2").arg(i).arg(serial_str));
74 
75  result.append(SamplingDevice(displayedName,
78  serial_str,
79  i,
82  1,
83  0));
84 
85  qDebug("PerseusPlugin::enumSampleSources: enumerated Perseus device #%d", i);
86  }
87 
88  return result;
89 }
90 
91 #ifdef SERVER_MODE
93  const QString& sourceId,
94  QWidget **widget,
95  DeviceUISet *deviceUISet)
96 {
97  (void) sourceId;
98  (void) widget;
99  (void) deviceUISet;
100  return 0;
101 }
102 #else
104  const QString& sourceId,
105  QWidget **widget,
106  DeviceUISet *deviceUISet)
107 {
108  if (sourceId == m_deviceTypeID)
109  {
110  PerseusGui* gui = new PerseusGui(deviceUISet);
111  *widget = gui;
112  return gui;
113  }
114  else
115  {
116  return 0;
117  }
118 }
119 #endif
120 
122 {
123  if (sourceId == m_deviceTypeID)
124  {
125  PerseusInput* input = new PerseusInput(deviceAPI);
126  return input;
127  }
128  else
129  {
130  return 0;
131  }
132 }
static DevicePerseus & instance()
static const PluginDescriptor m_pluginDescriptor
Definition: perseusplugin.h:51
static const int m_maxDevices
Definition: perseusplugin.h:48
void registerSampleSource(const QString &sourceName, PluginInterface *plugin)
Definition: pluginapi.cpp:9
void getSerials(std::vector< std::string > &serials) const
Definition: deviceperseus.h:30
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
virtual PluginInstanceGUI * createSampleSourcePluginInstanceGUI(const QString &sourceId, QWidget **widget, DeviceUISet *deviceUISet)
int32_t i
Definition: decimators.h:244
#define PERSEUS_DEVICE_TYPE_ID
Definition: perseusplugin.h:24
PerseusPlugin(QObject *parent=0)
const PluginDescriptor & getPluginDescriptor() const
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: perseusplugin.h:47
static const QString m_hardwareID
Definition: perseusplugin.h:46
void initPlugin(PluginAPI *pluginAPI)
virtual SamplingDevices enumSampleSources()
QList< SamplingDevice > SamplingDevices