Struct seify::Device

source ·
pub struct Device<T: DeviceTrait + Clone + Any> { /* private fields */ }
Expand description

Wrapps a driver, implementing the DeviceTrait.

Implements a more ergonomic version of the DeviceTrait, e.g., using Into<Args>, which would not be possible in traits.

Implementations§

source§

impl Device<GenericDevice>

source

pub fn new() -> Result<Self, Error>

Creates a GenericDevice opening the first device discovered through enumerate.

source

pub fn from_args<A: TryInto<Args>>(args: A) -> Result<Self, Error>

Creates a GenericDevice opening the first device with a given driver, specified in the args or the first device discovered through enumerate that matches the args.

source§

impl<T: DeviceTrait + Clone + Any> Device<T>

source

pub fn from_impl(dev: T) -> Self

Create a device from the device implementation.

source

pub fn impl_ref<D: DeviceTrait + Any>(&self) -> Result<&D, Error>

Try to downcast to a given device implementation D, either directly (from Device<D>) or indirectly (from a Device<GenericDevice> that wraps a D).

source

pub fn impl_mut<D: DeviceTrait + Any>(&mut self) -> Result<&mut D, Error>

Try to downcast mutably to a given device implementation D, either directly (from Device<D>) or indirectly (from a Device<GenericDevice> that wraps a D).

source§

impl<R: RxStreamer + 'static, T: TxStreamer + 'static, D: DeviceTrait<RxStreamer = R, TxStreamer = T> + Clone + 'static> Device<D>

source

pub fn driver(&self) -> Driver

SDR driver

source

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

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

source

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

Device info that can be displayed to the user.

source

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

Number of supported Channels.

source

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

Full Duplex support.

source

pub fn rx_streamer(&self, channels: &[usize]) -> Result<R, Error>

Create an RX streamer.

source

pub fn rx_streamer_with_args( &self, channels: &[usize], args: Args, ) -> Result<R, Error>

Create an RX streamer, using args.

source

pub fn tx_streamer(&self, channels: &[usize]) -> Result<T, Error>

Create a TX Streamer.

source

pub fn tx_streamer_with_args( &self, channels: &[usize], args: Args, ) -> Result<T, Error>

Create a TX Streamer, using args.

source

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

List of available antenna ports.

source

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

Currently used antenna port.

source

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

Set antenna port.

source

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

Does the device support automatic gain control?

source

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

Enable or disable automatic gain control.

source

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

Returns true, if automatic gain control is enabled

source

pub 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

pub 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

pub 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

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

Get the overall Range of possible gain values.

source

pub 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

pub 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

pub 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

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

Get the ranges of overall frequency values.

source

pub 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

pub fn set_frequency( &self, direction: Direction, channel: usize, frequency: f64, ) -> 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.

source

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

Like set_frequency but using args 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

pub 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

pub 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

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

Get the frequency of a tunable element in the chain.

source

pub 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

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

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

source

pub 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

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

Get the range of possible baseband sample rates.

Trait Implementations§

source§

impl<T: Clone + DeviceTrait + Clone + Any> Clone for Device<T>

source§

fn clone(&self) -> Device<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Device<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Device<T>
where T: RefUnwindSafe,

§

impl<T> Send for Device<T>

§

impl<T> Sync for Device<T>
where T: Sync,

§

impl<T> Unpin for Device<T>
where T: Unpin,

§

impl<T> UnwindSafe for Device<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.