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.
Public Member Functions | Static Public Attributes | Static Private Attributes | List of all members
HackRFInputPlugin Class Reference

#include <hackrfinputplugin.h>

+ Inheritance diagram for HackRFInputPlugin:
+ Collaboration diagram for HackRFInputPlugin:

Public Member Functions

 HackRFInputPlugin (QObject *parent=NULL)
 
const PluginDescriptorgetPluginDescriptor () const
 
void initPlugin (PluginAPI *pluginAPI)
 
virtual SamplingDevices enumSampleSources ()
 
virtual PluginInstanceGUIcreateSampleSourcePluginInstanceGUI (const QString &sourceId, QWidget **widget, DeviceUISet *deviceUISet)
 
virtual DeviceSampleSourcecreateSampleSourcePluginInstance (const QString &sourceId, DeviceAPI *deviceAPI)
 
- Public Member Functions inherited from PluginInterface
virtual ~PluginInterface ()
 
virtual PluginInstanceGUIcreateRxChannelGUI (DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
 
virtual BasebandSampleSinkcreateRxChannelBS (DeviceAPI *deviceAPI)
 
virtual ChannelAPIcreateRxChannelCS (DeviceAPI *deviceAPI)
 
virtual PluginInstanceGUIcreateTxChannelGUI (DeviceUISet *deviceUISet, BasebandSampleSource *txChannel)
 
virtual BasebandSampleSourcecreateTxChannelBS (DeviceAPI *deviceAPI)
 
virtual ChannelAPIcreateTxChannelCS (DeviceAPI *deviceAPI)
 
virtual void deleteSampleSourcePluginInstanceGUI (PluginInstanceGUI *ui)
 
virtual void deleteSampleSourcePluginInstanceInput (DeviceSampleSource *source)
 
virtual SamplingDevices enumSampleSinks ()
 
virtual PluginInstanceGUIcreateSampleSinkPluginInstanceGUI (const QString &sinkId, QWidget **widget, DeviceUISet *deviceUISet)
 
virtual DeviceSampleSinkcreateSampleSinkPluginInstance (const QString &sinkId, DeviceAPI *deviceAPI)
 
virtual void deleteSampleSinkPluginInstanceGUI (PluginInstanceGUI *ui)
 
virtual void deleteSampleSinkPluginInstanceOutput (DeviceSampleSink *sink)
 
virtual SamplingDevices enumSampleMIMO ()
 
virtual PluginInstanceGUIcreateSampleMIMOPluginInstanceGUI (const QString &mimoId, QWidget **widget, DeviceUISet *deviceUISet)
 
virtual DeviceSampleMIMOcreateSampleMIMOPluginInstance (const QString &mimoId, DeviceAPI *deviceAPI)
 
virtual void deleteSampleMIMOPluginInstanceGUI (PluginInstanceGUI *ui)
 
virtual void deleteSampleMIMOPluginInstanceMIMO (DeviceSampleMIMO *mimo)
 

Static Public Attributes

static const QString m_hardwareID = "HackRF"
 
static const QString m_deviceTypeID = HACKRF_DEVICE_TYPE_ID
 

Static Private Attributes

static const PluginDescriptor m_pluginDescriptor
 

Additional Inherited Members

- Public Types inherited from PluginInterface
typedef QList< SamplingDeviceSamplingDevices
 

Detailed Description

Definition at line 28 of file hackrfinputplugin.h.

Constructor & Destructor Documentation

◆ HackRFInputPlugin()

HackRFInputPlugin::HackRFInputPlugin ( QObject *  parent = NULL)
explicit

Definition at line 44 of file hackrfinputplugin.cpp.

44  :
45  QObject(parent)
46 {
47 }

Member Function Documentation

◆ createSampleSourcePluginInstance()

DeviceSampleSource * HackRFInputPlugin::createSampleSourcePluginInstance ( const QString &  sourceId,
DeviceAPI deviceAPI 
)
virtual

Reimplemented from PluginInterface.

Definition at line 156 of file hackrfinputplugin.cpp.

References m_deviceTypeID.

157 {
158  if (sourceId == m_deviceTypeID)
159  {
160  HackRFInput* input = new HackRFInput(deviceAPI);
161  return input;
162  }
163  else
164  {
165  return 0;
166  }
167 }
static const QString m_deviceTypeID

◆ createSampleSourcePluginInstanceGUI()

PluginInstanceGUI * HackRFInputPlugin::createSampleSourcePluginInstanceGUI ( const QString &  sourceId,
QWidget **  widget,
DeviceUISet deviceUISet 
)
virtual

Reimplemented from PluginInterface.

Definition at line 138 of file hackrfinputplugin.cpp.

References m_deviceTypeID.

Referenced by enumSampleSources().

142 {
143  if(sourceId == m_deviceTypeID)
144  {
145  HackRFInputGui* gui = new HackRFInputGui(deviceUISet);
146  *widget = gui;
147  return gui;
148  }
149  else
150  {
151  return 0;
152  }
153 }
static const QString m_deviceTypeID
+ Here is the caller graph for this function:

◆ enumSampleSources()

PluginInterface::SamplingDevices HackRFInputPlugin::enumSampleSources ( )
virtual

Reimplemented from PluginInterface.

Definition at line 59 of file hackrfinputplugin.cpp.

References arg(), createSampleSourcePluginInstanceGUI(), i, DeviceHackRF::instance(), m_deviceTypeID, m_hardwareID, PluginInterface::SamplingDevice::PhysicalDevice, and PluginInterface::SamplingDevice::StreamSingleRx.

60 {
62 // hackrf_error rc = (hackrf_error) hackrf_init();
63 //
64 // if (rc != HACKRF_SUCCESS)
65 // {
66 // qCritical("HackRFPlugin::SampleSourceDevices: failed to initiate HackRF library: %s", hackrf_error_name(rc));
67 // }
68 
69  SamplingDevices result;
70  hackrf_device_list_t *hackrf_devices = hackrf_device_list();
71  hackrf_device *hackrf_ptr;
72  read_partid_serialno_t read_partid_serialno;
73  int i;
74 
75  for (i=0; i < hackrf_devices->devicecount; i++)
76  {
77  hackrf_error rc = (hackrf_error) hackrf_device_list_open(hackrf_devices, i, &hackrf_ptr);
78 
79  if (rc == HACKRF_SUCCESS)
80  {
81  qDebug("HackRFPlugin::enumSampleSources: try to enumerate HackRF device #%d", i);
82 
83  rc = (hackrf_error) hackrf_board_partid_serialno_read(hackrf_ptr, &read_partid_serialno);
84 
85  if (rc != HACKRF_SUCCESS)
86  {
87  qDebug("HackRFPlugin::enumSampleSources: failed to read serial no: %s", hackrf_error_name(rc));
88  hackrf_close(hackrf_ptr);
89  continue; // next
90  }
91 
92  uint32_t serial_msb = read_partid_serialno.serial_no[2];
93  uint32_t serial_lsb = read_partid_serialno.serial_no[3];
94 
95  QString serial_str = QString::number(serial_msb, 16) + QString::number(serial_lsb, 16);
96  //uint64_t serial_num = (((uint64_t) serial_msb)<<32) + serial_lsb;
97  QString displayedName(QString("HackRF[%1] %2").arg(i).arg(serial_str));
98 
99  result.append(SamplingDevice(displayedName,
100  m_hardwareID,
102  serial_str,
103  i,
106  1,
107  0));
108 
109  qDebug("HackRFPlugin::enumSampleSources: enumerated HackRF device #%d", i);
110 
111  hackrf_close(hackrf_ptr);
112  }
113  else
114  {
115  qDebug("HackRFPlugin::enumSampleSources: failed to enumerate HackRF device #%d: %s", i, hackrf_error_name(rc));
116  }
117  }
118 
119  hackrf_device_list_free(hackrf_devices);
120 // rc = (hackrf_error) hackrf_exit();
121 // qDebug("HackRFPlugin::enumSampleSources: hackrf_exit: %s", hackrf_error_name(rc));
122 
123  return result;
124 }
static DeviceHackRF & instance()
unsigned int uint32_t
Definition: rtptypes_win.h:46
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
static const QString m_deviceTypeID
int32_t i
Definition: decimators.h:244
Exposes a single input stream that can be one of the streams of a physical device.
QList< SamplingDevice > SamplingDevices
static const QString m_hardwareID
+ Here is the call graph for this function:

◆ getPluginDescriptor()

const PluginDescriptor & HackRFInputPlugin::getPluginDescriptor ( ) const
virtual

Implements PluginInterface.

Definition at line 49 of file hackrfinputplugin.cpp.

References m_pluginDescriptor.

50 {
51  return m_pluginDescriptor;
52 }
static const PluginDescriptor m_pluginDescriptor

◆ initPlugin()

void HackRFInputPlugin::initPlugin ( PluginAPI pluginAPI)
virtual

Implements PluginInterface.

Definition at line 54 of file hackrfinputplugin.cpp.

References m_deviceTypeID, and PluginAPI::registerSampleSource().

55 {
56  pluginAPI->registerSampleSource(m_deviceTypeID, this);
57 }
void registerSampleSource(const QString &sourceName, PluginInterface *plugin)
Definition: pluginapi.cpp:9
static const QString m_deviceTypeID
+ Here is the call graph for this function:

Member Data Documentation

◆ m_deviceTypeID

const QString HackRFInputPlugin::m_deviceTypeID = HACKRF_DEVICE_TYPE_ID
static

◆ m_hardwareID

const QString HackRFInputPlugin::m_hardwareID = "HackRF"
static

Definition at line 46 of file hackrfinputplugin.h.

Referenced by enumSampleSources().

◆ m_pluginDescriptor

const PluginDescriptor HackRFInputPlugin::m_pluginDescriptor
staticprivate
Initial value:
= {
QString("HackRF Input"),
QString("4.5.4"),
QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"),
true,
QString("https://github.com/f4exb/sdrangel")
}

Definition at line 50 of file hackrfinputplugin.h.

Referenced by getPluginDescriptor().


The documentation for this class was generated from the following files: