GNU Radio's TEST Package

Public Member Functions | Static Public Member Functions | Friends | List of all members
soapy_source_c Class Reference

`#include <soapy_source_c.h>`

Inheritance diagram for soapy_source_c:

## Public Member Functions
bool | start ()
bool | stop ()
int | work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
size_t | get_num_channels (void)
osmosdr::meta_range_t | get_sample_rates (void)
double | set_sample_rate (double rate)
double | get_sample_rate (void)
osmosdr::freq_range_t | get_freq_range (size_t chan)
double | set_center_freq (double freq, size_t chan)
double | get_center_freq (size_t chan)
double | set_freq_corr (double ppm, size_t chan)
double | get_freq_corr (size_t chan)
std::vector< std::string > | get_gain_names (size_t chan)
osmosdr::gain_range_t | get_gain_range (size_t chan)
osmosdr::gain_range_t | get_gain_range (const std::string &name, size_t chan)
bool | set_gain_mode (bool automatic, size_t chan)
bool | get_gain_mode (size_t chan)
double | set_gain (double gain, size_t chan)
double | set_gain (double gain, const std::string &name, size_t chan)
double | get_gain (size_t chan)
double | get_gain (const std::string &name, size_t chan)
double | set_if_gain (double gain, size_t chan)
double | set_bb_gain (double gain, size_t chan)
std::vector< std::string > | get_antennas (size_t chan)
std::string | set_antenna (const std::string &antenna, size_t chan)
std::string | get_antenna (size_t chan)
void | set_dc_offset_mode (int mode, size_t chan)
void | set_dc_offset (const std::complex< double > &offset, size_t chan)
void | set_iq_balance_mode (int mode, size_t chan)
void | set_iq_balance (const std::complex< double > &balance, size_t chan)
double | set_bandwidth (double bandwidth, size_t chan)
double | get_bandwidth (size_t chan)
osmosdr::freq_range_t | get_bandwidth_range (size_t chan)
void | set_time_source (const std::string &source, const size_t mboard)
std::string | get_time_source (const size_t mboard)
std::vector< std::string > | get_time_sources (const size_t mboard)
void | set_clock_source (const std::string &source, const size_t mboard)
std::string | get_clock_source (const size_t mboard)
std::vector< std::string > | get_clock_sources (const size_t mboard)
double | get_clock_rate (size_t mboard)
void | set_clock_rate (double rate, size_t mboard)
::osmosdr::time_spec_t | get_time_now (size_t mboard)
::osmosdr::time_spec_t | get_time_last_pps (size_t mboard)
void | set_time_now (const ::osmosdr::time_spec_t &time_spec, size_t mboard)
void | set_time_next_pps (const ::osmosdr::time_spec_t &time_spec)
void | set_time_unknown_pps (const ::osmosdr::time_spec_t &time_spec)
Public Member Functions inherited from source_iface
virtual | ~source_iface ()=default
virtual size_t | get_num_channels (void)=0
virtual bool | seek (long seek_point, int whence, size_t chan=0)
| seek file to `seek_point` relative to `whence` More...
virtual osmosdr::meta_range_t | get_sample_rates (void)=0
virtual double | set_sample_rate (double rate)=0
virtual double | get_sample_rate (void)=0
virtual osmosdr::freq_range_t | get_freq_range (size_t chan=0)=0
virtual double | set_center_freq (double freq, size_t chan=0)=0
virtual double | get_center_freq (size_t chan=0)=0
virtual double | set_freq_corr (double ppm, size_t chan=0)=0
virtual double | get_freq_corr (size_t chan=0)=0
virtual std::vector< std::string > | get_gain_names (size_t chan=0)=0
virtual osmosdr::gain_range_t | get_gain_range (size_t chan=0)=0
virtual osmosdr::gain_range_t | get_gain_range (const std::string &name, size_t chan=0)=0
virtual bool | set_gain_mode (bool automatic, size_t chan=0)
virtual bool | get_gain_mode (size_t chan=0)
virtual double | set_gain (double gain, size_t chan=0)=0
virtual double | set_gain (double gain, const std::string &name, size_t chan=0)=0
virtual double | get_gain (size_t chan=0)=0
virtual double | get_gain (const std::string &name, size_t chan=0)=0
virtual double | set_if_gain (double gain, size_t chan=0)
virtual double | set_bb_gain (double gain, size_t chan=0)
virtual std::vector< std::string > | get_antennas (size_t chan=0)=0
virtual std::string | set_antenna (const std::string &antenna, size_t chan=0)=0
virtual std::string | get_antenna (size_t chan=0)=0
virtual void | set_dc_offset_mode (int mode, size_t chan=0)
virtual void | set_dc_offset (const std::complex< double > &offset, size_t chan=0)
virtual void | set_iq_balance_mode (int mode, size_t chan=0)
virtual void | set_iq_balance (const std::complex< double > &balance, size_t chan=0)
virtual double | set_bandwidth (double bandwidth, size_t chan=0)
virtual double | get_bandwidth (size_t chan=0)
virtual osmosdr::freq_range_t | get_bandwidth_range (size_t chan=0)
virtual void | set_time_source (const std::string &source, const size_t mboard=0)
virtual std::string | get_time_source (const size_t mboard)
virtual std::vector< std::string > | get_time_sources (const size_t mboard)
virtual void | set_clock_source (const std::string &source, const size_t mboard=0)
virtual std::string | get_clock_source (const size_t mboard)
virtual std::vector< std::string > | get_clock_sources (const size_t mboard)
virtual double | get_clock_rate (size_t mboard=0)
virtual void | set_clock_rate (double rate, size_t mboard=0)
virtual ::osmosdr::time_spec_t | get_time_now (size_t mboard=0)
virtual ::osmosdr::time_spec_t | get_time_last_pps (size_t mboard=0)
virtual void | set_time_now (const ::osmosdr::time_spec_t &time_spec, size_t mboard=0)
virtual void | set_time_next_pps (const ::osmosdr::time_spec_t &time_spec)
virtual void | set_time_unknown_pps (const ::osmosdr::time_spec_t &time_spec)

## Static Public Member Functions
static std::vector< std::string > | get_devices ()

## Friends
soapy_source_c_sptr | make_soapy_source_c (const std::string &args)
| Return a shared_ptr to a new instance of soapy_source_c. More...

## Member Function Documentation

## ◆ get_antenna()

std::string soapy_source_c::get_antenna | ( | size_t | chan | ) |
| virtual

Get the actual underlying radio hardware antenna setting.

Parameters

  chan | the channel index 0 to N-1

Returns
  the actual antenna's name

Implements source_iface.

## ◆ get_antennas()

std::vector< std::string > soapy_source_c::get_antennas | ( | size_t | chan | ) |
| virtual

Get the available antennas of the underlying radio hardware.

Parameters

  chan | the channel index 0 to N-1

Returns
  a vector of strings containing the names of available antennas

Implements source_iface.

## ◆ get_bandwidth()

double soapy_source_c::get_bandwidth | ( | size_t | chan | ) |
| virtual

Get the actual bandpass filter setting on the radio frontend.

Parameters

  chan | the channel index 0 to N-1

Returns
  the actual filter bandwidth in Hz

Reimplemented from source_iface.

## ◆ get_bandwidth_range()

osmosdr::freq_range_t soapy_source_c::get_bandwidth_range | ( | size_t | chan | ) |
| virtual

Get the possible bandpass filter settings on the radio frontend.

Parameters

  chan | the channel index 0 to N-1

Returns
  a range of bandwidths in Hz

Reimplemented from source_iface.

## ◆ get_center_freq()

double soapy_source_c::get_center_freq | ( | size_t | chan | ) |
| virtual

Get the center frequency the underlying radio hardware is tuned to. This is the actual frequency and may differ from the frequency set.

Parameters

  chan | the channel index 0 to N-1

Returns
  the frequency in Hz

Implements source_iface.

## ◆ get_clock_rate()

double soapy_source_c::get_clock_rate | ( | size_t | mboard | ) |
| virtual

Get the master clock rate.

Parameters

  mboard | the motherboard index 0 to M-1

Returns
  the clock rate in Hz

Reimplemented from source_iface.

## ◆ get_clock_source()

std::string soapy_source_c::get_clock_source | ( | const size_t | mboard | ) |
| virtual

Get the currently set clock source.

Parameters

  mboard | which motherboard to get the config

Returns
  the string representing the clock source

Reimplemented from source_iface.

## ◆ get_clock_sources()

std::vector< std::string > soapy_source_c::get_clock_sources | ( | const size_t | mboard | ) |
| virtual

Get a list of possible clock sources.

Parameters

  mboard | which motherboard to get the list

Returns
  a vector of strings for possible settings

Reimplemented from source_iface.

## ◆ get_devices()

static std::vector< std::string > soapy_source_c::get_devices | ( |  | ) |
| static

## ◆ get_freq_corr()

double soapy_source_c::get_freq_corr | ( | size_t | chan | ) |
| virtual

Get the frequency correction value.

Parameters

  chan | the channel index 0 to N-1

Returns
  correction value in parts per million

Implements source_iface.

## ◆ get_freq_range()

osmosdr::freq_range_t soapy_source_c::get_freq_range | ( | size_t | chan | ) |
| virtual

Get the tunable frequency range for the underlying radio hardware.

Parameters

  chan | the channel index 0 to N-1

Returns
  the frequency range in Hz

Implements source_iface.

## ◆ get_gain() [1/2]

double soapy_source_c::get_gain | ( | const std::string & | name,
|  | size_t | chan
| ) |  |
| virtual

Get the actual gain setting of a named stage.

Parameters

  name | the name of the gain stage
  chan | the channel index 0 to N-1

Returns
  the actual gain in dB

Implements source_iface.

## ◆ get_gain() [2/2]

double soapy_source_c::get_gain | ( | size_t | chan | ) |
| virtual

Get the actual gain setting of the underlying radio hardware.

Parameters

  chan | the channel index 0 to N-1

Returns
  the actual gain in dB

Implements source_iface.

## ◆ get_gain_mode()

bool soapy_source_c::get_gain_mode | ( | size_t | chan | ) |
| virtual

Get the gain mode selected for the underlying radio hardware.

Parameters

  chan | the channel index 0 to N-1

Returns
  the actual gain mode (true means automatic gain mode)

Reimplemented from source_iface.

## ◆ get_gain_names()

std::vector< std::string > soapy_source_c::get_gain_names | ( | size_t | chan | ) |
| virtual

Get the gain stage names of the underlying radio hardware.

Parameters

  chan | the channel index 0 to N-1

Returns
  a vector of strings containing the names of gain stages

Implements source_iface.

## ◆ get_gain_range() [1/2]

osmosdr::gain_range_t soapy_source_c::get_gain_range | ( | const std::string & | name,
|  | size_t | chan
| ) |  |
| virtual

Get the settable gain range for a specific gain stage.

Parameters

  name | the name of the gain stage
  chan | the channel index 0 to N-1

Returns
  the gain range in dB

Implements source_iface.

## ◆ get_gain_range() [2/2]

osmosdr::gain_range_t soapy_source_c::get_gain_range | ( | size_t | chan | ) |
| virtual

Get the settable overall gain range for the underlying radio hardware.

Parameters

  chan | the channel index 0 to N-1

Returns
  the gain range in dB

Implements source_iface.

## ◆ get_num_channels()

size_t soapy_source_c::get_num_channels | ( | void |  | ) |
| virtual

Get the number of channels the underlying radio hardware offers.

Returns
  the number of available channels

Implements source_iface.

## ◆ get_sample_rate()

double soapy_source_c::get_sample_rate | ( | void |  | ) |
| virtual

Get the sample rate for the underlying radio hardware. This is the actual sample rate and may differ from the rate set.

Returns
  the actual rate in Sps

Implements source_iface.

## ◆ get_sample_rates()

osmosdr::meta_range_t soapy_source_c::get_sample_rates | ( | void |  | ) |
| virtual

Get the possible sample rates for the underlying radio hardware.

Returns
  a range of rates in Sps

Implements source_iface.

## ◆ get_time_last_pps()

::osmosdr::time_spec_t soapy_source_c::get_time_last_pps | ( | size_t | mboard | ) |

## ◆ get_time_now()

::osmosdr::time_spec_t soapy_source_c::get_time_now | ( | size_t | mboard | ) |

## ◆ get_time_source()

std::string soapy_source_c::get_time_source | ( | const size_t | mboard | ) |
| virtual

Get the currently set time source.

Parameters

  mboard | which motherboard to get the config

Returns
  the string representing the time source

Reimplemented from source_iface.

## ◆ get_time_sources()

std::vector< std::string > soapy_source_c::get_time_sources | ( | const size_t | mboard | ) |
| virtual

Get a list of possible time sources.

Parameters

  mboard | which motherboard to get the list

Returns
  a vector of strings for possible settings

Reimplemented from source_iface.

## ◆ set_antenna()

std::string soapy_source_c::set_antenna | ( | const std::string & | antenna,
|  | size_t | chan
| ) |  |
| virtual

Select the active antenna of the underlying radio hardware.

Parameters

  antenna | the antenna name
  chan | the channel index 0 to N-1

Returns
  the actual antenna's name

Implements source_iface.

## ◆ set_bandwidth()

double soapy_source_c::set_bandwidth | ( | double | bandwidth,
|  | size_t | chan
| ) |  |
| virtual

Set the bandpass filter on the radio frontend.

Parameters

  bandwidth | the filter bandwidth in Hz, set to 0 for automatic selection
  chan | the channel index 0 to N-1

Returns
  the actual filter bandwidth in Hz

Reimplemented from source_iface.

## ◆ set_bb_gain()

double soapy_source_c::set_bb_gain | ( | double | gain,
|  | size_t | chan
| ) |  |
| virtual

Set the BB gain for the underlying radio hardware. This function will automatically distribute the desired gain value over available BB gain stages in an appropriate way and return the actual value.

Parameters

  gain | the gain in dB
  chan | the channel index 0 to N-1

Returns
  the actual gain in dB

Reimplemented from source_iface.

## ◆ set_center_freq()

double soapy_source_c::set_center_freq | ( | double | freq,
|  | size_t | chan
| ) |  |
| virtual

Tune the underlying radio hardware to the desired center frequency. This also will select the appropriate RF bandpass.

Parameters

  freq | the desired frequency in Hz
  chan | the channel index 0 to N-1

Returns
  the actual frequency in Hz

Implements source_iface.

## ◆ set_clock_rate()

void soapy_source_c::set_clock_rate | ( | double | rate,
|  | size_t | mboard
| ) |  |
| virtual

Set the master clock rate.

Parameters

  rate | the new rate in Hz
  mboard | the motherboard index 0 to M-1

Reimplemented from source_iface.

## ◆ set_clock_source()

void soapy_source_c::set_clock_source | ( | const std::string & | source,
|  | const size_t | mboard
| ) |  |
| virtual

Set the clock source for the device. This sets the source for a 10 Mhz reference clock. Typical options for source: internal, external, MIMO.

Parameters

  source | a string representing the clock source
  mboard | which motherboard to set the config

Reimplemented from source_iface.

## ◆ set_dc_offset()

void soapy_source_c::set_dc_offset | ( | const std::complex< double > & | offset,
|  | size_t | chan
| ) |  |
| virtual

Set a constant DC offset value. The value is complex to control both I and Q. Only set this when automatic correction is disabled.

Parameters

  offset | the dc offset (1.0 is full-scale)
  chan | the channel index 0 to N-1

Reimplemented from source_iface.

## ◆ set_dc_offset_mode()

void soapy_source_c::set_dc_offset_mode | ( | int | mode,
|  | size_t | chan
| ) |  |
| virtual

Set the RX frontend DC correction mode. The automatic correction subtracts out the long-run average.

When disabled, the averaging option operation is reset. Once in Manual mode, the average value will be held constant until the user re-enables the automatic correction or overrides the value by manually setting the offset.

Parameters

  mode | dc offset correction mode: 0 = Off, 1 = Manual, 2 = Automatic
  chan | the channel index 0 to N-1

Reimplemented from source_iface.

## ◆ set_freq_corr()

double soapy_source_c::set_freq_corr | ( | double | ppm,
|  | size_t | chan
| ) |  |
| virtual

Set the frequency correction value in parts per million.

Parameters

  ppm | the desired correction value in parts per million
  chan | the channel index 0 to N-1

Returns
  correction value in parts per million

Implements source_iface.

## ◆ set_gain() [1/2]

double soapy_source_c::set_gain | ( | double | gain,
|  | const std::string & | name,
|  | size_t | chan
| ) |  |
| virtual

Set the named gain on the underlying radio hardware.

Parameters

  gain | the gain in dB
  name | the name of the gain stage
  chan | the channel index 0 to N-1

Returns
  the actual gain in dB

Implements source_iface.

## ◆ set_gain() [2/2]

double soapy_source_c::set_gain | ( | double | gain,
|  | size_t | chan
| ) |  |
| virtual

Set the gain for the underlying radio hardware. This function will automatically distribute the desired gain value over available gain stages in an appropriate way and return the actual value.

Parameters

  gain | the gain in dB
  chan | the channel index 0 to N-1

Returns
  the actual gain in dB

Implements source_iface.

## ◆ set_gain_mode()

bool soapy_source_c::set_gain_mode | ( | bool | automatic,
|  | size_t | chan
| ) |  |
| virtual

Set the gain mode for the underlying radio hardware. This might be supported only for certain hardware types.

Parameters

  automatic | the gain mode (true means automatic gain mode)
  chan | the channel index 0 to N-1

Returns
  the actual gain mode

Reimplemented from source_iface.

## ◆ set_if_gain()

double soapy_source_c::set_if_gain | ( | double | gain,
|  | size_t | chan
| ) |  |
| virtual

Set the IF gain for the underlying radio hardware. This function will automatically distribute the desired gain value over available IF gain stages in an appropriate way and return the actual value.

Parameters

  gain | the gain in dB
  chan | the channel index 0 to N-1

Returns
  the actual gain in dB

Reimplemented from source_iface.

## ◆ set_iq_balance()

void soapy_source_c::set_iq_balance | ( | const std::complex< double > & | balance,
|  | size_t | chan
| ) |  |
| virtual

Set the RX frontend IQ balance correction. Use this to adjust the magnitude and phase of I and Q.

Parameters

  balance | the complex correction value
  chan | the channel index 0 to N-1

Reimplemented from source_iface.

## ◆ set_iq_balance_mode()

void soapy_source_c::set_iq_balance_mode | ( | int | mode,
|  | size_t | chan
| ) |  |
| virtual

Set the RX frontend IQ balance mode.

Parameters

  mode | iq balance correction mode: 0 = Off, 1 = Manual, 2 = Automatic
  chan | the channel index 0 to N-1

Reimplemented from source_iface.

## ◆ set_sample_rate()

double soapy_source_c::set_sample_rate | ( | double | rate | ) |
| virtual

Set the sample rate for the underlying radio hardware. This also will select the appropriate IF bandpass, if applicable.

Parameters

  rate | a new rate in Sps

Implements source_iface.

## ◆ set_time_next_pps()

void soapy_source_c::set_time_next_pps | ( | const ::osmosdr::time_spec_t & | time_spec | ) |
| virtual

Set the time registers at the next pps.

Parameters

  time_spec | the new time

Reimplemented from source_iface.

## ◆ set_time_now()

void soapy_source_c::set_time_now | ( | const ::osmosdr::time_spec_t & | time_spec,
|  | size_t | mboard
| ) |  |
| virtual

Sets the time registers immediately.

Parameters

  time_spec | the new time
  mboard | the motherboard index 0 to M-1

Reimplemented from source_iface.

## ◆ set_time_source()

void soapy_source_c::set_time_source | ( | const std::string & | source,
|  | const size_t | mboard
| ) |  |
| virtual

Set the time source for the device. This sets the method of time synchronization, typically a pulse per second or an encoded time. Typical options for source: external, MIMO.

Parameters

  source | a string representing the time source
  mboard | which motherboard to set the config

Reimplemented from source_iface.

## ◆ set_time_unknown_pps()

void soapy_source_c::set_time_unknown_pps | ( | const ::osmosdr::time_spec_t & | time_spec | ) |
| virtual

Sync the time registers with an unknown pps edge.

Parameters

  time_spec | the new time

Reimplemented from source_iface.

## ◆ start()

bool soapy_source_c::start | ( |  | ) |

## ◆ stop()

bool soapy_source_c::stop | ( |  | ) |

## ◆ work()

int soapy_source_c::work | ( | int | noutput_items,
|  | gr_vector_const_void_star & | input_items,
|  | gr_vector_void_star & | output_items
| ) |  |

## Friends And Related Function Documentation

## ◆ make_soapy_source_c

soapy_source_c_sptr make_soapy_source_c | ( | const std::string & | args | ) |
| friend

Return a shared_ptr to a new instance of soapy_source_c.

To avoid accidental use of raw pointers, soapy_source_c's constructor is private. soapy_make_source_c is the public interface for creating new instances.

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

- soapy_source_c.h