GNU Radio's SOAPY Package
gr::soapy::source_impl Class Reference

Source block implementation for SDR devices. More...

#include <source_impl.h>

Inheritance diagram for gr::soapy::source_impl:
gr::soapy::source

Public Member Functions

 source_impl (size_t nchan, const std::string &device, const std::string &dev_args, const std::string &stream_args, const std::vector< std::string > &tune_args, const std::vector< std::string > &other_settings, double sampling_rate, const std::string &type)
 
 ~source_impl ()
 
virtual bool start ()
 
virtual bool stop ()
 
int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
 
std::vector< std::string > get_antennas (int channel)
 
void set_frequency (size_t channel, double frequency)
 
void set_frequency (size_t channel, const std::string &name, double frequency)
 
void set_gain (size_t channel, float gain)
 
void set_gain (size_t channel, const std::string name, float gain)
 
bool gain_available (size_t channel, const std::string &name)
 
void set_agc (size_t channel, bool enable)
 
void set_sample_rate (size_t channel, double sample_rate)
 
void set_bandwidth (size_t channel, double bandwidth)
 
void set_antenna (size_t channel, const std::string &name)
 
void set_dc_offset (size_t channel, gr_complexd dc_offset)
 
void set_dc_removal (size_t channel, bool automatic)
 
void set_frequency_correction (size_t channel, double freq_correction)
 
void set_iq_balance (size_t channel, gr_complexd iq_balance)
 
void set_master_clock_rate (double clock_rate)
 
void set_clock_source (const std::string &clock_source)
 
void set_frontend_mapping (const std::string &frontend_mapping)
 
double get_frequency (size_t channel)
 
double get_gain (size_t channel)
 
bool get_gain_mode (size_t channel)
 
double get_sampling_rate (size_t channel)
 
double get_bandwidth (size_t channel)
 
std::string get_antenna (size_t channel)
 
std::complex< double > get_dc_offset (size_t channel)
 
bool get_dc_offset_mode (size_t channel)
 
double get_frequency_correction (size_t channel)
 
std::complex< double > get_iq_balance (size_t channel)
 
double get_master_clock_rate ()
 
std::string get_clock_source ()
 
void msg_handler_command (pmt::pmt_t msg)
 
void cmd_handler_frequency (pmt::pmt_t val, size_t chann)
 
void cmd_handler_gain (pmt::pmt_t val, size_t chann)
 
void cmd_handler_samp_rate (pmt::pmt_t val, size_t chann)
 
void cmd_handler_bw (pmt::pmt_t val, size_t chann)
 
void cmd_handler_antenna (pmt::pmt_t val, size_t chann)
 

Additional Inherited Members

- Public Types inherited from gr::soapy::source
typedef boost::shared_ptr< sourcesptr
 
- Static Public Member Functions inherited from gr::soapy::source
static sptr make (size_t nchan, const std::string &device, const std::string &dev_args, const std::string &stream_args, const std::vector< std::string > &tune_args, const std::vector< std::string > &other_settings, double sampling_rate, const std::string &type)
 Return a shared_ptr to a new instance of soapy::source. More...
 

Detailed Description

Source block implementation for SDR devices.

Constructor & Destructor Documentation

◆ source_impl()

gr::soapy::source_impl::source_impl ( size_t  nchan,
const std::string &  device,
const std::string &  dev_args,
const std::string &  stream_args,
const std::vector< std::string > &  tune_args,
const std::vector< std::string > &  other_settings,
double  sampling_rate,
const std::string &  type 
)

◆ ~source_impl()

gr::soapy::source_impl::~source_impl ( )

Member Function Documentation

◆ cmd_handler_antenna()

void gr::soapy::source_impl::cmd_handler_antenna ( pmt::pmt_t  val,
size_t  chann 
)

Set the anntena element for the RX chain.

Parameters
valname of the anntena
channan available channel on the device

◆ cmd_handler_bw()

void gr::soapy::source_impl::cmd_handler_bw ( pmt::pmt_t  val,
size_t  chann 
)

Set the baseband filter width for the RX chain.

Parameters
valbaseband filter width in Hz
channan available channel on the device

◆ cmd_handler_frequency()

void gr::soapy::source_impl::cmd_handler_frequency ( pmt::pmt_t  val,
size_t  chann 
)

Set the center frequency of the RX chain.

Parameters
valcenter frequency in Hz
channan available channel on the device

◆ cmd_handler_gain()

void gr::soapy::source_impl::cmd_handler_gain ( pmt::pmt_t  val,
size_t  chann 
)

Set the overall gain for the specified chain. The gain will be distributed automatically across available elements according to Soapy API.

Parameters
valthe new amplification value in dB
channan avalaible channel on the device

◆ cmd_handler_samp_rate()

void gr::soapy::source_impl::cmd_handler_samp_rate ( pmt::pmt_t  val,
size_t  chann 
)

Set the baseband sample rate for the RX chain.

Parameters
valthe sample rate samples per second
channan available channel on the device

◆ gain_available()

bool gr::soapy::source_impl::gain_available ( size_t  channel,
const std::string &  name 
)

Checks if the specified gain type for the given channel is available

Parameters
channelan available channel on the device
nanean available gain on the device
Returns
true if the gain setting exists, false otherwise

◆ get_antenna()

std::string gr::soapy::source_impl::get_antenna ( size_t  channel)

Get the selected antenna on RX chain.

Parameters
channelan available channel on the device
Returns
the name of the selected antenna

◆ get_antennas()

std::vector<std::string> gr::soapy::source_impl::get_antennas ( int  channel)
virtual

Returns a list with the available antennas for a specific channel

Parameters
channelthe channel index
Returns
the available antenna names

Implements gr::soapy::source.

◆ get_bandwidth()

double gr::soapy::source_impl::get_bandwidth ( size_t  channel)

Get baseband filter width of the RX chain.

Parameters
channelan available channel on the device
Returns
the baseband filter width in Hz

◆ get_clock_source()

std::string gr::soapy::source_impl::get_clock_source ( )

Get the clock source of the device

Returns
the name of the clock source

◆ get_dc_offset()

std::complex<double> gr::soapy::source_impl::get_dc_offset ( size_t  channel)

Get the DC offset correction.

Parameters
channelan available channel on the device
Returns
the relative correction (1.0 max)

◆ get_dc_offset_mode()

bool gr::soapy::source_impl::get_dc_offset_mode ( size_t  channel)

Get the automatic DC offset correction mode.

Parameters
channelan available channel on the device
Returns
true for automatic offset correction

◆ get_frequency()

double gr::soapy::source_impl::get_frequency ( size_t  channel)

Get the down conversion frequency of the chain.

Parameters
channelan available channel on the device
Returns
the center frequency in Hz

◆ get_frequency_correction()

double gr::soapy::source_impl::get_frequency_correction ( size_t  channel)

Get the frequency correction value.

Parameters
channelan available channel on the device
Returns
the correction value in PPM

◆ get_gain()

double gr::soapy::source_impl::get_gain ( size_t  channel)

Get the overall value of the gain elements in a chain

Parameters
channelan available channel on the device
Returns
the value of the gain in dB

◆ get_gain_mode()

bool gr::soapy::source_impl::get_gain_mode ( size_t  channel)

Get the automatic gain mode on the RX chain.

Parameters
channelan available channel on the device
Returns
true for automatic gain setting

◆ get_iq_balance()

std::complex<double> gr::soapy::source_impl::get_iq_balance ( size_t  channel)

Get the IQ balance correction.

Parameters
channelan available channel on the device
Returns
the relative correction (1.0 max)

◆ get_master_clock_rate()

double gr::soapy::source_impl::get_master_clock_rate ( )

Get the master clock rate of the device.

Returns
the clock rate in Hz

◆ get_sampling_rate()

double gr::soapy::source_impl::get_sampling_rate ( size_t  channel)

Get the baseband sample rate of the RX chain.

Parameters
channelan available channel on the device
Returns
the sample rate in samples per second

◆ msg_handler_command()

void gr::soapy::source_impl::msg_handler_command ( pmt::pmt_t  msg)

Calls the correct message handler according to the received message symbol. A dictionary with key the handler name is used in order to call the corresponding handler.

Parameters
msga PMT dictionary

◆ set_agc()

void gr::soapy::source_impl::set_agc ( size_t  channel,
bool  enable 
)
virtual

Set the automatic gain mode for the specified chain if supported. If not supported set gain value manually.

Parameters
channelan available channel on the device
enabletrue for automatic gain mode

Implements gr::soapy::source.

◆ set_antenna()

void gr::soapy::source_impl::set_antenna ( size_t  channel,
const std::string &  name 
)
virtual

Set the antenna element for the RX chain.

Parameters
channelan available channel on the device
namethe name of an available antenna

Implements gr::soapy::source.

◆ set_bandwidth()

void gr::soapy::source_impl::set_bandwidth ( size_t  channel,
double  bandwidth 
)
virtual

Set the baseband filter width of the RX chain

Parameters
channelan available channel on the device
bandwidththe baseband filter width in Hz

Implements gr::soapy::source.

◆ set_clock_source()

void gr::soapy::source_impl::set_clock_source ( const std::string &  clock_source)
virtual

Set the clock source of the device

Parameters
clock_sourcethe name of clock source

Implements gr::soapy::source.

◆ set_dc_offset()

void gr::soapy::source_impl::set_dc_offset ( size_t  channel,
gr_complexd  dc_offset 
)
virtual

Set the dc offset correction for the RX chain. If the dc offset correction automatic mode is on the value is omitted and the device sets the dc offset correction automatically.

Parameters
channelan available channel on the device
dc_offsetthe relative correction (1.0 max)

Implements gr::soapy::source.

◆ set_dc_removal()

void gr::soapy::source_impl::set_dc_removal ( size_t  channel,
bool  automatic 
)
virtual

Set automatic DC removal to the RX chain if supported by the device.

Parameters
channelan available channel on the device
automatictrue for automatic DC offset correction

Implements gr::soapy::source.

◆ set_frequency() [1/2]

void gr::soapy::source_impl::set_frequency ( size_t  channel,
double  frequency 
)
virtual

Set the center frequency for the specified RX chain. Default implementation tunes RF component frequency as close as possible to the requested frequency. See specific device module for more information.

Parameters
channelan available channel on the device
frequencycenter frequency in Hz

Implements gr::soapy::source.

◆ set_frequency() [2/2]

void gr::soapy::source_impl::set_frequency ( size_t  channel,
const std::string &  name,
double  frequency 
)
virtual

Set the center frequency for the specified RX chain of the element. Default implementation tunes RF component frequency as close as possible to the requested frequency. See specific device module for more information

Parameters
channelan available channel on the device
namean available element name
frequencycenter frequency in Hz

Implements gr::soapy::source.

◆ set_frequency_correction()

void gr::soapy::source_impl::set_frequency_correction ( size_t  channel,
double  freq_correction 
)
virtual

Set the frequency correction to the RX chain.

Parameters
channelan available channel on the device
freq_correctionthe correction value in PPM

Implements gr::soapy::source.

◆ set_frontend_mapping()

void gr::soapy::source_impl::set_frontend_mapping ( const std::string &  frontend_mapping)

Set the frontend mapping of available DSP units to RF frontends. This mapping controls channel mapping and channel availability.

Parameters
frontend_mappinga vendor-specific mapping string

◆ set_gain() [1/2]

void gr::soapy::source_impl::set_gain ( size_t  channel,
float  gain 
)
virtual

Set the overall gain for the specified RX chain. The gain will be distributed automatically across available elements according to Soapy API.

Parameters
channelan available channel on the device
gainthe new amplification value in dB

Implements gr::soapy::source.

◆ set_gain() [2/2]

void gr::soapy::source_impl::set_gain ( size_t  channel,
const std::string  name,
float  gain 
)
virtual

Set the value for the specified gain for the specified TX chain.

Parameters
channelan available channel on the device
namean available gain on the device
gaingain the new amplification value in dB

Implements gr::soapy::source.

◆ set_iq_balance()

void gr::soapy::source_impl::set_iq_balance ( size_t  channel,
gr_complexd  iq_balance 
)
virtual

Set iq balance correction to the RX chain

Parameters
channelan available channel on the device
iq_balancethe relative correction (1.0 max)

Implements gr::soapy::source.

◆ set_master_clock_rate()

void gr::soapy::source_impl::set_master_clock_rate ( double  clock_rate)
virtual

Set the master clock rate of the device

Parameters
clock_ratethe clock rate in Hz

Implements gr::soapy::source.

◆ set_sample_rate()

void gr::soapy::source_impl::set_sample_rate ( size_t  channel,
double  sample_rate 
)
virtual

Set the baseband sample rate for the RX chain.

Parameters
channelan available channel on the device
sample_ratethe sample rate samples per second

Implements gr::soapy::source.

◆ start()

virtual bool gr::soapy::source_impl::start ( )
virtual

◆ stop()

virtual bool gr::soapy::source_impl::stop ( )
virtual

◆ work()

int gr::soapy::source_impl::work ( int  noutput_items,
gr_vector_const_void_star &  input_items,
gr_vector_void_star &  output_items 
)

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