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

#include <devicesoapysdr.h>

+ Collaboration diagram for DeviceSoapySDR:

Public Member Functions

SoapySDR::Device * openSoapySDR (uint32_t sequence, const QString &hardwareUserArguments)
 
void closeSoapySdr (SoapySDR::Device *device)
 
uint32_t getNbDevices () const
 
const std::vector< DeviceSoapySDRScan::SoapySDRDeviceEnum > & getDevicesEnumeration () const
 

Static Public Member Functions

static DeviceSoapySDRinstance ()
 

Static Public Attributes

static const unsigned int blockSize = (1<<14)
 

Protected Member Functions

 DeviceSoapySDR ()
 
 DeviceSoapySDR (const DeviceSoapySDR &)
 
DeviceSoapySDRoperator= (const DeviceSoapySDR &other)
 
 ~DeviceSoapySDR ()
 

Private Member Functions

SoapySDR::Device * openopenSoapySDRFromSequence (uint32_t sequence, const QString &hardwareUserArguments)
 

Private Attributes

DeviceSoapySDRScan m_scanner
 

Detailed Description

Definition at line 27 of file devicesoapysdr.h.

Constructor & Destructor Documentation

◆ DeviceSoapySDR() [1/2]

DeviceSoapySDR::DeviceSoapySDR ( )
protected

Definition at line 21 of file devicesoapysdr.cpp.

References m_scanner, and DeviceSoapySDRScan::scan().

22 {
23  m_scanner.scan();
24 }
DeviceSoapySDRScan m_scanner
+ Here is the call graph for this function:

◆ DeviceSoapySDR() [2/2]

DeviceSoapySDR::DeviceSoapySDR ( const DeviceSoapySDR )
inlineprotected

Definition at line 41 of file devicesoapysdr.h.

41 {}

◆ ~DeviceSoapySDR()

DeviceSoapySDR::~DeviceSoapySDR ( )
protected

Definition at line 26 of file devicesoapysdr.cpp.

27 {}

Member Function Documentation

◆ closeSoapySdr()

void DeviceSoapySDR::closeSoapySdr ( SoapySDR::Device *  device)

Definition at line 41 of file devicesoapysdr.cpp.

Referenced by SoapySDROutput::closeDevice(), and SoapySDRInput::closeDevice().

42 {
43  SoapySDR::Device::unmake(device);
44 }
+ Here is the caller graph for this function:

◆ getDevicesEnumeration()

const std::vector<DeviceSoapySDRScan::SoapySDRDeviceEnum>& DeviceSoapySDR::getDevicesEnumeration ( ) const
inline

Definition at line 35 of file devicesoapysdr.h.

Referenced by SoapySDROutputPlugin::enumSampleSinks(), and SoapySDRInputPlugin::enumSampleSources().

35 { return m_scanner.getDevicesEnumeration(); }
const std::vector< SoapySDRDeviceEnum > & getDevicesEnumeration() const
DeviceSoapySDRScan m_scanner
+ Here is the caller graph for this function:

◆ getNbDevices()

uint32_t DeviceSoapySDR::getNbDevices ( ) const
inline

Definition at line 34 of file devicesoapysdr.h.

34 { return m_scanner.getNbDevices(); }
uint32_t getNbDevices() const
DeviceSoapySDRScan m_scanner

◆ instance()

DeviceSoapySDR & DeviceSoapySDR::instance ( )
static

◆ openopenSoapySDRFromSequence()

SoapySDR::Device * DeviceSoapySDR::openopenSoapySDRFromSequence ( uint32_t  sequence,
const QString &  hardwareUserArguments 
)
private

Definition at line 46 of file devicesoapysdr.cpp.

References DeviceSoapySDRScan::getDevicesEnumeration(), DeviceSoapySDRScan::getNbDevices(), i, DeviceSoapySDRScan::SoapySDRDeviceEnum::m_driverName, DeviceSoapySDRScan::SoapySDRDeviceEnum::m_idKey, DeviceSoapySDRScan::SoapySDRDeviceEnum::m_idValue, DeviceSoapySDRScan::SoapySDRDeviceEnum::m_label, and m_scanner.

Referenced by openSoapySDR().

47 {
48  if (sequence > m_scanner.getNbDevices())
49  {
50  return 0;
51  }
52  else
53  {
55 
56  try
57  {
58  SoapySDR::Kwargs kwargs;
59  kwargs["driver"] = deviceEnum.m_driverName.toStdString();
60 
61  if (hardwareUserArguments.size() > 0)
62  {
63  QStringList kvArgs = hardwareUserArguments.split(',');
64 
65  for (int i = 0; i < kvArgs.size(); i++)
66  {
67  QStringList kv = kvArgs.at(i).split('=');
68 
69  if (kv.size() > 1) {
70  kwargs[kv.at(0).toStdString()] = kv.at(1).toStdString();
71  }
72  }
73  }
74  else if (deviceEnum.m_idKey.size() > 0)
75  {
76  kwargs[deviceEnum.m_idKey.toStdString()] = deviceEnum.m_idValue.toStdString();
77  }
78 
79  SoapySDR::Kwargs::const_iterator it = kwargs.begin();
80 
81  for (; it != kwargs.end(); ++it) {
82  qDebug("DeviceSoapySDR::openopenSoapySDRFromSequence: %s=%s", it->first.c_str(), it->second.c_str());
83  }
84 
85  SoapySDR::Device *device = SoapySDR::Device::make(kwargs);
86  return device;
87  }
88  catch (const std::exception &ex)
89  {
90  qWarning("DeviceSoapySDR::openopenSoapySDRFromSequence: %s cannot be opened: %s",
91  deviceEnum.m_label.toStdString().c_str(), ex.what());
92  return 0;
93  }
94  }
95 }
const std::vector< SoapySDRDeviceEnum > & getDevicesEnumeration() const
QString m_idValue
value for the above key
uint32_t getNbDevices() const
int32_t i
Definition: decimators.h:244
QString m_label
the label key for display should always be present
DeviceSoapySDRScan m_scanner
QString m_idKey
key to uniquely identify device
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openSoapySDR()

SoapySDR::Device * DeviceSoapySDR::openSoapySDR ( uint32_t  sequence,
const QString &  hardwareUserArguments 
)

Definition at line 35 of file devicesoapysdr.cpp.

References instance(), and openopenSoapySDRFromSequence().

Referenced by SoapySDROutput::openDevice(), and SoapySDRInput::openDevice().

36 {
37  instance();
38  return openopenSoapySDRFromSequence(sequence, hardwareUserArguments);
39 }
static DeviceSoapySDR & instance()
SoapySDR::Device * openopenSoapySDRFromSequence(uint32_t sequence, const QString &hardwareUserArguments)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

DeviceSoapySDR& DeviceSoapySDR::operator= ( const DeviceSoapySDR other)
inlineprotected

Definition at line 42 of file devicesoapysdr.h.

42 { (void) other; return *this; }

Member Data Documentation

◆ blockSize

const unsigned int DeviceSoapySDR::blockSize = (1<<14)
static

Definition at line 37 of file devicesoapysdr.h.

◆ m_scanner

DeviceSoapySDRScan DeviceSoapySDR::m_scanner
private

Definition at line 47 of file devicesoapysdr.h.

Referenced by DeviceSoapySDR(), and openopenSoapySDRFromSequence().


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