DeviceTrait

Trait DeviceTrait 

Source
pub trait DeviceTrait: Any + Send {
    type RxStreamer: RxStreamer;
    type TxStreamer: TxStreamer;

Show 38 methods // Required methods fn as_any(&self) -> &dyn Any; fn as_any_mut(&mut self) -> &mut dyn Any; fn driver(&self) -> Driver; fn id(&self) -> Result<String, Error>; fn info(&self) -> Result<Args, Error>; fn num_channels(&self, direction: Direction) -> Result<usize, Error>; fn full_duplex( &self, direction: Direction, channel: usize, ) -> Result<bool, Error>; fn rx_streamer( &self, channels: &[usize], args: Args, ) -> Result<Self::RxStreamer, Error>; fn tx_streamer( &self, channels: &[usize], args: Args, ) -> Result<Self::TxStreamer, Error>; fn antennas( &self, direction: Direction, channel: usize, ) -> Result<Vec<String>, Error>; fn antenna( &self, direction: Direction, channel: usize, ) -> Result<String, Error>; fn set_antenna( &self, direction: Direction, channel: usize, name: &str, ) -> Result<(), Error>; fn supports_agc( &self, direction: Direction, channel: usize, ) -> Result<bool, Error>; fn enable_agc( &self, direction: Direction, channel: usize, agc: bool, ) -> Result<(), Error>; fn agc(&self, direction: Direction, channel: usize) -> Result<bool, Error>; fn gain_elements( &self, direction: Direction, channel: usize, ) -> Result<Vec<String>, Error>; fn set_gain( &self, direction: Direction, channel: usize, gain: f64, ) -> Result<(), Error>; fn gain( &self, direction: Direction, channel: usize, ) -> Result<Option<f64>, Error>; fn gain_range( &self, direction: Direction, channel: usize, ) -> Result<Range, Error>; fn set_gain_element( &self, direction: Direction, channel: usize, name: &str, gain: f64, ) -> Result<(), Error>; fn gain_element( &self, direction: Direction, channel: usize, name: &str, ) -> Result<Option<f64>, Error>; fn gain_element_range( &self, direction: Direction, channel: usize, name: &str, ) -> Result<Range, Error>; fn frequency_range( &self, direction: Direction, channel: usize, ) -> Result<Range, Error>; fn frequency( &self, direction: Direction, channel: usize, ) -> Result<f64, Error>; fn set_frequency( &self, direction: Direction, channel: usize, frequency: f64, args: Args, ) -> Result<(), Error>; fn frequency_components( &self, direction: Direction, channel: usize, ) -> Result<Vec<String>, Error>; fn component_frequency_range( &self, direction: Direction, channel: usize, name: &str, ) -> Result<Range, Error>; fn component_frequency( &self, direction: Direction, channel: usize, name: &str, ) -> Result<f64, Error>; fn set_component_frequency( &self, direction: Direction, channel: usize, name: &str, frequency: f64, ) -> Result<(), Error>; fn sample_rate( &self, direction: Direction, channel: usize, ) -> Result<f64, Error>; fn set_sample_rate( &self, direction: Direction, channel: usize, rate: f64, ) -> Result<(), Error>; fn get_sample_rate_range( &self, direction: Direction, channel: usize, ) -> Result<Range, Error>; fn bandwidth( &self, direction: Direction, channel: usize, ) -> Result<f64, Error>; fn set_bandwidth( &self, direction: Direction, channel: usize, bw: f64, ) -> Result<(), Error>; fn get_bandwidth_range( &self, direction: Direction, channel: usize, ) -> Result<Range, Error>; fn has_dc_offset_mode( &self, direction: Direction, channel: usize, ) -> Result<bool, Error>; fn set_dc_offset_mode( &self, direction: Direction, channel: usize, automatic: bool, ) -> Result<(), Error>; fn dc_offset_mode( &self, direction: Direction, channel: usize, ) -> Result<bool, Error>;
}
Expand description

Central trait, implemented by hardware drivers.

Required Associated Types§

Source

type RxStreamer: RxStreamer

Associated RX streamer

Source

type TxStreamer: TxStreamer

Associated TX streamer

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Cast to Any for downcasting.

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Cast to Any for downcasting to a mutable reference.

Source

fn driver(&self) -> Driver

SDR driver

Source

fn id(&self) -> Result<String, Error>

Identifier for the device, e.g., its serial.

Source

fn info(&self) -> Result<Args, Error>

Device info that can be displayed to the user.

Source

fn num_channels(&self, direction: Direction) -> Result<usize, Error>

Number of supported Channels.

Source

fn full_duplex( &self, direction: Direction, channel: usize, ) -> Result<bool, Error>

Full Duplex support.

Source

fn rx_streamer( &self, channels: &[usize], args: Args, ) -> Result<Self::RxStreamer, Error>

Create an RX streamer.

Source

fn tx_streamer( &self, channels: &[usize], args: Args, ) -> Result<Self::TxStreamer, Error>

Create a TX streamer.

Source

fn antennas( &self, direction: Direction, channel: usize, ) -> Result<Vec<String>, Error>

List of available antenna ports.

Source

fn antenna(&self, direction: Direction, channel: usize) -> Result<String, Error>

Currently used antenna port.

Source

fn set_antenna( &self, direction: Direction, channel: usize, name: &str, ) -> Result<(), Error>

Set antenna port.

Source

fn supports_agc( &self, direction: Direction, channel: usize, ) -> Result<bool, Error>

Does the device support automatic gain control?

Source

fn enable_agc( &self, direction: Direction, channel: usize, agc: bool, ) -> Result<(), Error>

Enable or disable automatic gain control.

Source

fn agc(&self, direction: Direction, channel: usize) -> Result<bool, Error>

Returns true, if automatic gain control is enabled

Source

fn gain_elements( &self, direction: Direction, channel: usize, ) -> Result<Vec<String>, Error>

List of available gain elements.

Elements should be in order RF to baseband.

Source

fn set_gain( &self, direction: Direction, channel: usize, gain: f64, ) -> Result<(), Error>

Set the overall amplification in a chain.

The gain will be distributed automatically across available elements.

gain: the new amplification value in dB

Source

fn gain( &self, direction: Direction, channel: usize, ) -> Result<Option<f64>, Error>

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

Source

fn gain_range( &self, direction: Direction, channel: usize, ) -> Result<Range, Error>

Get the overall Range of possible gain values.

Source

fn set_gain_element( &self, direction: Direction, channel: usize, name: &str, gain: f64, ) -> Result<(), Error>

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
Source

fn gain_element( &self, direction: Direction, channel: usize, name: &str, ) -> Result<Option<f64>, Error>

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

Source

fn gain_element_range( &self, direction: Direction, channel: usize, name: &str, ) -> Result<Range, Error>

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

Source

fn frequency_range( &self, direction: Direction, channel: usize, ) -> Result<Range, Error>

Get the ranges of overall frequency values.

Source

fn frequency(&self, direction: Direction, channel: usize) -> Result<f64, Error>

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.

Source

fn set_frequency( &self, direction: Direction, channel: usize, frequency: f64, args: Args, ) -> Result<(), Error>

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.
Source

fn frequency_components( &self, direction: Direction, channel: usize, ) -> Result<Vec<String>, Error>

List available tunable elements in the chain.

Elements should be in order RF to baseband.

Source

fn component_frequency_range( &self, direction: Direction, channel: usize, name: &str, ) -> Result<Range, Error>

Get the range of tunable values for the specified element.

Source

fn component_frequency( &self, direction: Direction, channel: usize, name: &str, ) -> Result<f64, Error>

Get the frequency of a tunable element in the chain.

Source

fn set_component_frequency( &self, direction: Direction, channel: usize, name: &str, frequency: f64, ) -> Result<(), Error>

Tune the center frequency of the specified element.

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

fn sample_rate( &self, direction: Direction, channel: usize, ) -> Result<f64, Error>

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

Source

fn set_sample_rate( &self, direction: Direction, channel: usize, rate: f64, ) -> Result<(), Error>

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

Source

fn get_sample_rate_range( &self, direction: Direction, channel: usize, ) -> Result<Range, Error>

Get the range of possible baseband sample rates.

Source

fn bandwidth(&self, direction: Direction, channel: usize) -> Result<f64, Error>

Get the hardware bandwidth filter, if available.

Returns Err(Error::NotSupported) if unsupported in underlying driver.

Source

fn set_bandwidth( &self, direction: Direction, channel: usize, bw: f64, ) -> Result<(), Error>

Set the hardware bandwidth filter, if available.

Returns Err(Error::NotSupported) if unsupported in underlying driver.

Source

fn get_bandwidth_range( &self, direction: Direction, channel: usize, ) -> Result<Range, Error>

Get the range of possible bandwidth filter values, if available.

Returns Err(Error::NotSupported) if unsupported in underlying driver.

Source

fn has_dc_offset_mode( &self, direction: Direction, channel: usize, ) -> Result<bool, Error>

Returns true if automatic corrections are supported

Source

fn set_dc_offset_mode( &self, direction: Direction, channel: usize, automatic: bool, ) -> Result<(), Error>

Enable or disable automatic DC offset corrections mode.

Source

fn dc_offset_mode( &self, direction: Direction, channel: usize, ) -> Result<bool, Error>

Returns true if automatic DC offset mode is enabled

Implementors§