Radio Control Functions

Enable and Disable

Each subdevice may allow the TX and RX sections be enabled or disabled by the functions below.

bool vxsdr::get_tx_enabled(const uint8_t subdev = 0)

Determine if the transmit RF section is enabled.

Parameters

subdev – the subdevice number

Returns

true if the command succeeds and the section is enabled, false otherwise

bool vxsdr::get_rx_enabled(const uint8_t subdev = 0)

Determine if the receive RF section is enabled.

Parameters

subdev – the subdevice number

Returns

true if the command succeeds and the section is enabled, false otherwise

bool vxsdr::set_tx_enabled(const bool enabled, const uint8_t subdev = 0)

Enable or disable the transmit RF section.

Parameters
  • enabled – the desired state

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_rx_enabled(const bool enabled, const uint8_t subdev = 0)

Enable or disable the receive RF section.

Parameters
  • enabled – the desired state

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

Tuning

Each subdevice may have an adjustable RF frequency, with information and control provided by the functions below.

std::optional<std::array<double, 2>> vxsdr::get_tx_freq_range(const uint8_t subdev = 0)

Get the transmit center frequency range.

Parameters

subdev – the subdevice number

Returns

a std::optional with a std::array containing the minimum and maximum frequencies in Hz

std::optional<std::array<double, 2>> vxsdr::get_rx_freq_range(const uint8_t subdev = 0)

Get the receive center frequency range.

Parameters

subdev – the subdevice number

Returns

a std::optional with a std::array containing the minimum and maximum frequencies in Hz

std::optional<double> vxsdr::get_tx_freq(const uint8_t subdev = 0)

Get the current transmit center frequency.

Parameters

subdev – the subdevice number

Returns

a std::optional with the center frequency in Hz

std::optional<double> vxsdr::get_rx_freq(const uint8_t subdev = 0)

Get the current receive center frequency.

Parameters

subdev – the subdevice number

Returns

a std::optional with the center frequency in Hz

bool vxsdr::set_tx_freq(const double freq_hz, const uint8_t subdev = 0)

Set the transmit center frequency.

Parameters
  • freq_hz – the desired frequency in Hz

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_rx_freq(const double freq_hz, const uint8_t subdev = 0)

Set the receive center frequency.

Parameters
  • freq_hz – the desired frequency in Hz

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

Gain Control

Each subdevice may have an adjustable gain, with information and control provided by the functions below.

std::optional<std::array<double, 2>> vxsdr::get_tx_gain_range(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the gain range for a transmit channel.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with a std::array containing the minimum and maximum gains in dB

std::optional<std::array<double, 2>> vxsdr::get_rx_gain_range(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the gain range for a receive channel.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with a std::array containing the minimum and maximum gains in dB

std::optional<double> vxsdr::get_tx_gain(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the current gain for a transmit channel.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with the gain in dB

std::optional<double> vxsdr::get_rx_gain(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the current gain for a receive channel.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with the gain in dB

bool vxsdr::set_tx_gain(const double gain_db, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the gain for a transmit channel.

Parameters
  • gain_db – the desired gain in dB

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_rx_gain(const double gain_db, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the gain for a receive channel.

Parameters
  • gain_db – the desired gain in dB

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise

Sampling Rate

Each subdevice may have an adjustable sampling rate, with information and control provided by the functions below.

std::optional<std::array<double, 2>> vxsdr::get_tx_rate_range(const uint8_t subdev = 0)

Get the transmit sample rate range.

Parameters

subdev – the subdevice number

Returns

a std::optional with a std::array containing the minimum and maximum sample rates in samples/s

std::optional<std::array<double, 2>> vxsdr::get_rx_rate_range(const uint8_t subdev = 0)

Get the receive sample rate range.

Parameters

subdev – the subdevice number

Returns

a std::optional with a std::array containing the minimum and maximum sample rates in samples/s

std::optional<double> vxsdr::get_tx_rate(const uint8_t subdev = 0)

Get the current transmit sample rate.

Parameters

subdev – the subdevice number

Returns

a std::optional with the rate in samples/s

std::optional<double> vxsdr::get_rx_rate(const uint8_t subdev = 0)

Get the current receive sample rate.

Parameters

subdev – the subdevice number

Returns

a std::optional with the rate in samples/s

bool vxsdr::set_tx_rate(const double rate_samples_sec, const uint8_t subdev = 0)

Set the transmit sample rate.

Parameters
  • rate_samples_sec – the desired rate in samples/s

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_rx_rate(const double rate_samples_sec, const uint8_t subdev = 0)

Set the receive sample rate.

Parameters
  • rate_samples_sec – the desired rate in samples/s

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

Inputs and Outputs

Each channel may have selectable input and output ports, with information and control provided by the functions below.

std::optional<unsigned> vxsdr::get_tx_num_ports(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the number of transmit output ports for a channel.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with the number of output ports

std::optional<unsigned> vxsdr::get_rx_num_ports(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the number of receive input ports for a channel.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with the number of input ports

std::optional<std::string> vxsdr::get_tx_port_name(const unsigned port_num, const uint8_t subdev = 0, const uint8_t channel = 0)

Get the name of a transmit output port.

Parameters
  • port_num – the port number

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with the name of the specified output port

std::optional<std::string> vxsdr::get_rx_port_name(const unsigned port_num, const uint8_t subdev = 0, const uint8_t channel = 0)

Get the name of a receive input port.

Parameters
  • port_num – the port number

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with the name of the specified input port

std::optional<unsigned> vxsdr::get_tx_port(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the current transmit output port.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with the port number

std::optional<unsigned> vxsdr::get_rx_port(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the current receive input port.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with the port number

bool vxsdr::set_tx_port(const unsigned port_num, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the transmit output port by number.

Parameters
  • port_num – the desired output port number

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_rx_port(const unsigned port_num, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the receive input port by number.

Parameters
  • port_num – the desired input port number

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_tx_port_by_name(const std::string &port_name, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the transmit output port by name.

Parameters
  • port_name – the desired output port name

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_rx_port_by_name(const std::string &port_name, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the receive input port by name.

Parameters
  • port_name – the desired input port name

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise

Radio Information

Each device or subdevice provides several functions to determine its properties and its state.

Device level functions:

std::optional<unsigned> vxsdr::get_tx_num_subdevs()

Get the number of transmit subdevices.

Returns

a std::optional with the number of subdevices

std::optional<unsigned> vxsdr::get_rx_num_subdevs()

Get the number of receive subdevices.

Returns

a std::optional with the number of subdevices

Subdevice level functions:

std::optional<unsigned> vxsdr::get_tx_num_channels(const uint8_t subdev = 0)

Get the number of transmit channels.

Parameters

subdev – the subdevice number

Returns

a std::optional with the number of channels

std::optional<unsigned> vxsdr::get_rx_num_channels(const uint8_t subdev = 0)

Get the number of receive channels.

Parameters

subdev – the subdevice number

Returns

a std::optional with the number of channels

std::optional<vxsdr::stream_state> vxsdr::get_tx_stream_state(const uint8_t subdev = 0)

Get the current radio transmit stream state.

Parameters

subdev – the subdevice number

Returns

a std::optional with a stream_state containing the transmit stream state

std::optional<vxsdr::stream_state> vxsdr::get_rx_stream_state(const uint8_t subdev = 0)

Get the current radio receive stream state.

Parameters

subdev – the subdevice number

Returns

a std::optional with a stream_state containing the receive stream state

bool vxsdr::get_tx_lo_locked(const uint8_t subdev = 0)

Determine whether the TX LO is locked.

Parameters

subdev – the subdevice number

Returns

true if the command succeeds and the TX LO is locked, false otherwise

bool vxsdr::get_rx_lo_locked(const uint8_t subdev = 0)

Determine whether the RX LO is locked.

Parameters

subdev – the subdevice number

Returns

true if the command succeeds and the RX LO is locked, false otherwise

External LO

Each subdevice may allow selection of an external LO, allowing phase synchronization across many devices.

bool vxsdr::get_tx_external_lo_enabled(const uint8_t subdev = 0)

Determine if the transmit external LO input is enabled.

Parameters

subdev – the subdevice number

Returns

true if the command succeeds and the external LO is enabled, false otherwise

bool vxsdr::get_rx_external_lo_enabled(const uint8_t subdev = 0)

Determine if the receive external LO input is enabled.

Parameters

subdev – the subdevice number

Returns

true if the command succeeds and the external LO is enabled, false otherwise

bool vxsdr::set_tx_external_lo_enabled(const bool enabled, const uint8_t subdev = 0)

Enable or disable the transmit external LO input.

Parameters
  • enabled – the desired state

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_rx_external_lo_enabled(const bool enabled, const uint8_t subdev = 0)

Enable or disable the receive external LO input.

Parameters
  • enabled – the desired state

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

Digital Filters

Each channel may have a complex FIR filter which operates at the master clock rate for equalization, fractional delay, or other purposes.

The filter lengths are the same across all channels, and the filters on all channels are enabled or disabled together.

std::optional<unsigned> vxsdr::get_tx_filter_length(const uint8_t subdev = 0)

Get the transmit frontend FIR filter’s length (maximum number of complex coefficients).

Parameters

subdev – the subdevice number

Returns

a std::optional with the length (zero if no filter is present)

std::optional<unsigned> vxsdr::get_rx_filter_length(const uint8_t subdev = 0)

Get the receive frontend FIR filter’s length (maximum number of complex coefficients).

Parameters

subdev – the subdevice number

Returns

a std::optional with the with the length (zero if no filter is present)

bool vxsdr::set_tx_filter_enabled(const bool enabled, const uint8_t subdev = 0)

Enable or disable the transmit frontend FIR filter.

Parameters
  • enabled – the desired state

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_rx_filter_enabled(const bool enabled, const uint8_t subdev = 0)

Enable or disable the receive frontend FIR filter.

Parameters
  • enabled – the desired state

  • subdev – the subdevice number

Returns

true if the command succeeds, false otherwise

The coefficients of the filters may differ across channels.

std::optional<std::vector<std::complex<int16_t>>> vxsdr::get_tx_filter_coeffs(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the transmit frontend FIR filter coefficients.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with a std::vector<std::complex<int16t>> containing the filter coefficients

std::optional<std::vector<std::complex<int16_t>>> vxsdr::get_rx_filter_coeffs(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the receive frontend FIR filter coefficients.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with a std::vector<std::complex<int16t>> containing the filter coefficients

bool vxsdr::set_tx_filter_coeffs(const std::vector<std::complex<int16_t>> &coeffs, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the transmit frontend FIR filter coefficients.

Parameters
  • coeffs – a std::vector<std::complex<int16t>> containing the filter coefficients

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_rx_filter_coeffs(const std::vector<std::complex<int16_t>> &coeffs, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the receive frontend FIR filter coefficients.

Parameters
  • coeffs – a std::vector<std::complex<int16t>> containing the filter coefficients

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise

Corrections

Each channel may allow manual adjustment of IQ bias, which provides control of LO feedthrough, and manual correction of IQ amplitude and phase imbalance, which provides control of image rejection.

std::optional<std::array<double, 2>> vxsdr::get_tx_iq_bias(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the IQ DC bias for a transmit channel.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with a std::array containing (i_bias, q_bias) with (-1 >= i_bias >= 1) and (-1 >= q_bias >= 1)

std::optional<std::array<double, 2>> vxsdr::get_rx_iq_bias(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the IQ DC bias for a receive channel.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with a std::array containing (i_bias, q_bias) with (-1 >= i_bias >= 1) and (-1 >= q_bias >= 1)

bool vxsdr::set_tx_iq_bias(const std::array<double, 2> bias, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the IQ DC bias for the transmitter to control LO feedthrough.

Parameters
  • bias – a std::array containing i_bias, q_bias in that order

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_rx_iq_bias(const std::array<double, 2> bias, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the IQ DC bias for the receiver to control LO feedthrough.

Parameters
  • bias – a std::array containing i_bias, q_bias in that order

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise

std::optional<std::array<double, 4>> vxsdr::get_tx_iq_corr(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the IQ correction for a transmit channel.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with a std::array containing a_ii, a_iq, a_qi, a_qq (in that order), which are the coefficients of the matrix which transforms the IQ data on transmission.

std::optional<std::array<double, 4>> vxsdr::get_rx_iq_corr(const uint8_t subdev = 0, const uint8_t channel = 0)

Get the IQ correction for a receive channel.

Parameters
  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

a std::optional with a std::array containing a_ii, a_iq, a_qi, a_qq (in that order), which are the coefficients of the matrix which transforms the IQ data on reception.

bool vxsdr::set_tx_iq_corr(const std::array<double, 4> corr, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the IQ correction for a transmit channel to control image rejection.

Parameters
  • corr – a std::array containing a_ii, a_iq, a_qi, a_qq (in that order), which are the coefficients of the matrix which transforms the IQ data on transmission.

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise

bool vxsdr::set_rx_iq_corr(const std::array<double, 4> corr, const uint8_t subdev = 0, const uint8_t channel = 0)

Set the IQ correction for a receive channel to control image rejection.

Parameters
  • corr – a std::array containing a_ii, a_iq, a_qi, a_qq (in that order), which are the coefficients of the matrix which transforms the IQ data on reception.

  • subdev – the subdevice number

  • channel – the channel number within the subdevice

Returns

true if the command succeeds, false otherwise