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>
impl Device<GenericDevice>
source§impl<T: DeviceTrait + Clone + Any> Device<T>
impl<T: DeviceTrait + Clone + Any> Device<T>
source§impl<R: RxStreamer + 'static, T: TxStreamer + 'static, D: DeviceTrait<RxStreamer = R, TxStreamer = T> + Clone + 'static> Device<D>
impl<R: RxStreamer + 'static, T: TxStreamer + 'static, D: DeviceTrait<RxStreamer = R, TxStreamer = T> + Clone + 'static> Device<D>
sourcepub fn num_channels(&self, direction: Direction) -> Result<usize, Error>
pub fn num_channels(&self, direction: Direction) -> Result<usize, Error>
Number of supported Channels.
sourcepub fn full_duplex(
&self,
direction: Direction,
channel: usize,
) -> Result<bool, Error>
pub fn full_duplex( &self, direction: Direction, channel: usize, ) -> Result<bool, Error>
Full Duplex support.
sourcepub fn rx_streamer(&self, channels: &[usize]) -> Result<R, Error>
pub fn rx_streamer(&self, channels: &[usize]) -> Result<R, Error>
Create an RX streamer.
sourcepub fn rx_streamer_with_args(
&self,
channels: &[usize],
args: Args,
) -> Result<R, Error>
pub fn rx_streamer_with_args( &self, channels: &[usize], args: Args, ) -> Result<R, Error>
Create an RX streamer, using args.
sourcepub fn tx_streamer(&self, channels: &[usize]) -> Result<T, Error>
pub fn tx_streamer(&self, channels: &[usize]) -> Result<T, Error>
Create a TX Streamer.
sourcepub fn tx_streamer_with_args(
&self,
channels: &[usize],
args: Args,
) -> Result<T, Error>
pub fn tx_streamer_with_args( &self, channels: &[usize], args: Args, ) -> Result<T, Error>
Create a TX Streamer, using args.
sourcepub fn antennas(
&self,
direction: Direction,
channel: usize,
) -> Result<Vec<String>, Error>
pub fn antennas( &self, direction: Direction, channel: usize, ) -> Result<Vec<String>, Error>
List of available antenna ports.
sourcepub fn antenna(
&self,
direction: Direction,
channel: usize,
) -> Result<String, Error>
pub fn antenna( &self, direction: Direction, channel: usize, ) -> Result<String, Error>
Currently used antenna port.
sourcepub fn set_antenna(
&self,
direction: Direction,
channel: usize,
name: &str,
) -> Result<(), Error>
pub fn set_antenna( &self, direction: Direction, channel: usize, name: &str, ) -> Result<(), Error>
Set antenna port.
sourcepub fn supports_agc(
&self,
direction: Direction,
channel: usize,
) -> Result<bool, Error>
pub fn supports_agc( &self, direction: Direction, channel: usize, ) -> Result<bool, Error>
Does the device support automatic gain control?
sourcepub fn enable_agc(
&self,
direction: Direction,
channel: usize,
agc: bool,
) -> Result<(), Error>
pub fn enable_agc( &self, direction: Direction, channel: usize, agc: bool, ) -> Result<(), Error>
Enable or disable automatic gain control.
sourcepub fn agc(&self, direction: Direction, channel: usize) -> Result<bool, Error>
pub fn agc(&self, direction: Direction, channel: usize) -> Result<bool, Error>
Returns true, if automatic gain control is enabled
sourcepub fn gain_elements(
&self,
direction: Direction,
channel: usize,
) -> Result<Vec<String>, Error>
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.
sourcepub fn set_gain(
&self,
direction: Direction,
channel: usize,
gain: f64,
) -> Result<(), Error>
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
sourcepub fn gain(
&self,
direction: Direction,
channel: usize,
) -> Result<Option<f64>, Error>
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.
sourcepub fn gain_range(
&self,
direction: Direction,
channel: usize,
) -> Result<Range, Error>
pub fn gain_range( &self, direction: Direction, channel: usize, ) -> Result<Range, Error>
Get the overall Range of possible gain values.
sourcepub fn set_gain_element(
&self,
direction: Direction,
channel: usize,
name: &str,
gain: f64,
) -> Result<(), Error>
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 fromDevice::list_gainsgain: the new amplification value in dB
sourcepub fn gain_element(
&self,
direction: Direction,
channel: usize,
name: &str,
) -> Result<Option<f64>, Error>
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.
sourcepub fn gain_element_range(
&self,
direction: Direction,
channel: usize,
name: &str,
) -> Result<Range, Error>
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.
sourcepub fn frequency_range(
&self,
direction: Direction,
channel: usize,
) -> Result<Range, Error>
pub fn frequency_range( &self, direction: Direction, channel: usize, ) -> Result<Range, Error>
Get the ranges of overall frequency values.
sourcepub fn frequency(
&self,
direction: Direction,
channel: usize,
) -> Result<f64, Error>
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.
sourcepub fn set_frequency(
&self,
direction: Direction,
channel: usize,
frequency: f64,
) -> Result<(), Error>
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.
sourcepub fn set_frequency_with_args(
&self,
direction: Direction,
channel: usize,
frequency: f64,
args: Args,
) -> Result<(), Error>
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.
sourcepub fn frequency_components(
&self,
direction: Direction,
channel: usize,
) -> Result<Vec<String>, Error>
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.
sourcepub fn component_frequency_range(
&self,
direction: Direction,
channel: usize,
name: &str,
) -> Result<Range, Error>
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.
sourcepub fn component_frequency(
&self,
direction: Direction,
channel: usize,
name: &str,
) -> Result<f64, Error>
pub fn component_frequency( &self, direction: Direction, channel: usize, name: &str, ) -> Result<f64, Error>
Get the frequency of a tunable element in the chain.
sourcepub fn set_component_frequency(
&self,
direction: Direction,
channel: usize,
name: &str,
frequency: f64,
) -> Result<(), Error>
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.
sourcepub fn sample_rate(
&self,
direction: Direction,
channel: usize,
) -> Result<f64, Error>
pub fn sample_rate( &self, direction: Direction, channel: usize, ) -> Result<f64, Error>
Get the baseband sample rate of the chain in samples per second.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)