Trait seify::DeviceTrait

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

Show 34 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_stream(&self, channels: &[usize]) -> Result<Self::RxStreamer, Error>; fn rx_stream_with_args(
        &self,
        channels: &[usize],
        args: Args
    ) -> Result<Self::RxStreamer, Error>; fn tx_stream(&self, channels: &[usize]) -> Result<Self::TxStreamer, Error>; fn tx_stream_with_args(
        &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 gain_elements(
        &self,
        direction: Direction,
        channel: usize
    ) -> Result<Vec<String>, Error>; fn suports_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 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
    ) -> 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,
        args: Args
    ) -> 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>;
}
Expand description

Central trait, implemented by hardware drivers.

Required Associated Types§

Required Methods§

Cast to Any for downcasting.

Cast to Any for downcasting to a mutable reference.

SDR driver

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

Device info that can be displayed to the user.

Number of supported Channels.

Full Duplex support.

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

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.

Implementors§