Skip to main content

Device

Struct Device 

Source
pub struct Device<M: SampleMode = F32Iq> { /* private fields */ }
Expand description

Owned device handle with a separately owned receive stream. Dropping the handle does not interrupt an outstanding stream, even if stopped.

Implementations§

Source§

impl Device<F32Iq>

Source

pub fn list() -> impl MaybeFuture<Output = Result<Vec<DeviceDescriptor>>>

List visible receivers with the standard Realtek USB IDs, without opening them.

Source

pub fn builder() -> DeviceBuilder

Start a device builder with default configuration.

Source

pub fn open() -> impl MaybeFuture<Output = Result<Self>>

Open the first visible receiver with default configuration.

Source

pub fn open_serial( serial: impl Into<String>, ) -> impl MaybeFuture<Output = Result<Self>>

Open a device by its exact USB serial string.

Source§

impl<M: SampleMode> Device<M>

Source

pub fn info(&self) -> &DeviceInfo

Immutable device metadata.

Source

pub fn config(&self) -> &Config<M>

Last successfully applied configuration. A failed/canceled configuration leaves this snapshot unchanged and requires a complete configure retry.

Source

pub fn actual_frequency_hz(&self) -> u64

Last successfully programmed center frequency after divider quantization.

Source

pub fn actual_sample_rate_hz(&self) -> u32

Last successfully programmed complex sample rate after divider quantization.

Source

pub fn configure( &mut self, config: &Config<M>, ) -> impl MaybeFuture<Output = Result<()>> + '_

Apply a complete configuration. This also recovers from a failed or canceled control operation. Controls are serialized; overlapping operations from a stream return crate::Error::Busy and can be retried.

Queued samples may predate a live configuration change. Stop and restart the stream when the caller needs previously queued samples discarded.

Source

pub fn set_frequency_hz( &mut self, hz: u64, ) -> impl MaybeFuture<Output = Result<()>> + '_

Tune the center frequency in Hz, preserving other settings.

Source

pub fn set_sample_rate_hz( &mut self, hz: u32, ) -> impl MaybeFuture<Output = Result<()>> + '_

Set complex sample rate, preserving other settings.

Source

pub fn set_gain( &mut self, gain: GainConfig, ) -> impl MaybeFuture<Output = Result<()>> + '_

Change tuner gain policy, preserving other settings.

Source

pub fn set_correction_ppm( &mut self, ppm: i32, ) -> impl MaybeFuture<Output = Result<()>> + '_

Correct the sampling clock and reapply tuning with the corrected crystal frequency.

Source

pub fn set_bias_tee( &mut self, enabled: bool, ) -> impl MaybeFuture<Output = Result<()>> + '_

Enable or disable GPIO 0 bias power, preserving other settings.

Source

pub fn set_direct_sampling( &mut self, mode: DirectSampling, ) -> impl MaybeFuture<Output = Result<()>> + '_

Set low-frequency direct sampling policy, preserving other settings.

Source

pub fn rx_stream(&self) -> Result<RxStream<M>>

Claim the single receive stream. The stream starts only when start is waited/awaited. Dormant and stopped streams retain the claim until close/drop.

Source

pub fn shutdown(&mut self) -> impl MaybeFuture<Output = Result<()>> + '_

Stop the hardware and disable RF bias power.

Returns Busy without changing lifecycle while a stream claim is held. Close/drop the stream first. Unpolled shutdown has no effects; once begun, shutdown is terminal, idempotent after success, and retryable on failure or cancellation. All independent cleanup steps are attempted on error.

Final-owner Drop performs the same cleanup best-effort, blocking on native targets and scheduling a background task on WebUSB. Explicit shutdown is required to observe cleanup errors/completion.

Trait Implementations§

Source§

impl<M: Debug + SampleMode> Debug for Device<M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<M> Freeze for Device<M>
where Config<M>: Freeze,

§

impl<M> RefUnwindSafe for Device<M>

§

impl<M> Send for Device<M>
where Config<M>: Send,

§

impl<M> Sync for Device<M>
where Config<M>: Sync,

§

impl<M> Unpin for Device<M>
where Config<M>: Unpin,

§

impl<M> UnsafeUnpin for Device<M>
where Config<M>: UnsafeUnpin,

§

impl<M> UnwindSafe for Device<M>
where Config<M>: 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.