Struct soapysdr::Device

source ·
pub struct Device { /* private fields */ }
Expand description

An opened SDR hardware device.

Implementations§

Find and open a device matching a set of filters.

Example
let mut d = soapysdr::Device::new("type=null").unwrap();

A key that uniquely identifies the device driver.

This key identifies the underlying implementation. Several variants of a product may share a driver.

A key that uniquely identifies the hardware.

This key should be meaningful to the user to optimize for the underlying hardware.

Query a dictionary of available device information.

This dictionary can any number of values like vendor name, product name, revisions, serials…

This information can be displayed to the user to help identify the instantiated device.

Get the mapping configuration string.

Set the frontend mapping of available DSP units to RF frontends.

This controls channel mapping and channel availability.

Get a number of channels given the streaming direction

Get channel info given the streaming direction

Find out if the specified channel is full or half duplex.

Returns true for full duplex, false for half duplex.

Query a list of the available stream formats.

Get the hardware’s native stream format and full-scale value for this channel.

This is the format used by the underlying transport layer, and the direct buffer access API calls (when available).

Query the argument info description for stream args.

Initialize an RX stream given a list of channels

Initialize an RX stream given a list of channels and stream arguments.

Initialize a TX stream given a list of channels and stream arguments.

Initialize a TX stream given a list of channels and stream arguments.

Get a list of available antennas to select on a given chain.

Set the selected antenna on a chain.

Get the selected antenna on a chain.

Does the device support automatic DC offset corrections?

Returns true if automatic corrections are supported

Enable or disable automatic DC offset corrections mode.

Returns true if automatic DC offset mode is enabled

Does the device support frontend DC offset corrections?

Returns true if manual corrections are supported

Set the frontend DC offset correction.

The offsets are configured for each of the I and Q components (1.0 max)

Get the frontend DC offset correction for (I, Q), 1.0 max

Does the device support frontend IQ balance correction?

Returns true if IQ balance corrections are supported.

Set the frontend IQ balance correction

The correction is configured for each of the I and Q components (1.0 max)

Get the frontend IQ balance correction for (I, Q), 1.0 max

List available amplification elements.

Elements should be in order RF to baseband.

Does the device support automatic gain control?

Enable or disable automatic gain control.

Returns true if automatic gain control is enabled

Set the overall amplification in a chain.

The gain will be distributed automatically across available elements.

gain: the new amplification value in dB

Get the overall value of the gain elements in a chain in dB.

Get the overall range of possible gain values.

Set the value of a amplification element in a chain.

Arguments
  • name: the name of an amplification element from Device::list_gains
  • gain: the new amplification value in dB

Get the value of an individual amplification element in a chain in dB.

Get the range of possible gain values for a specific element.

Get the ranges of overall frequency values.

Get the overall center frequency of the chain.

  • For RX, this specifies the down-conversion frequency.
  • For TX, this specifies the up-conversion frequency.

Returns the center frequency in Hz.

Set the center frequency of the chain.

  • For RX, this specifies the down-conversion frequency.
  • For TX, this specifies the up-conversion frequency.

The default implementation of set_frequency will tune the “RF” component as close as possible to the requested center frequency in Hz. Tuning inaccuracies will be compensated for with the “BB” component.

The args can be used to augment the tuning algorithm.

  • Use "OFFSET" to specify an “RF” tuning offset, usually with the intention of moving the LO out of the passband. The offset will be compensated for using the “BB” component.
  • Use the name of a component for the key and a frequency in Hz as the value (any format) to enforce a specific frequency. The other components will be tuned with compensation to achieve the specified overall frequency.
  • Use the name of a component for the key and the value "IGNORE" so that the tuning algorithm will avoid altering the component.
  • Vendor specific implementations can also use the same args to augment tuning in other ways such as specifying fractional vs integer N tuning.

List available tunable elements in the chain.

Elements should be in order RF to baseband.

Get the range of tunable values for the specified element.

Get the frequency of a tunable element in the chain.

Tune the center frequency of the specified element.

  • For RX, this specifies the down-conversion frequency.
  • For TX, this specifies the up-conversion frequency.

Recommended names used to represent tunable components:

  • “CORR” - freq error correction in PPM
  • “RF” - frequency of the RF frontend
  • “BB” - frequency of the baseband DSP

Query the argument info description for tune args.

Get the baseband sample rate of the chain in samples per second.

Set the baseband sample rate of the chain in samples per second.

Get the range of possible baseband sample rates.

Get the baseband filter width of the chain in Hz

Set the baseband filter width of the chain in Hz

Get the ranges of possible baseband filter widths.

List time sources

Get the current time source

Set the current time source

Check whether there is a given hardware time source. Hardware time sources are not the same as time sources (at least for UHD Devices) UHD supported hw time sources: “PPS” or “” (i.e. None)

Get the current timestamp in ns

Set the current hardware timestmap for the given source UHD supported hardware times: “CMD”,“PPS”,“UNKNOWN_PPS”

List clock sources

Get the current clock source

Set the current clock source

Write a setting

Read a setting

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.