Skip to main content

Device

Struct Device 

Source
pub struct Device { /* private fields */ }
Expand description

High-level owned HackRF device handle.

Implementations§

Source§

impl Device

Source

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

List visible normal-mode HackRF devices without claiming them.

Source

pub fn builder() -> DeviceBuilder

Start building and opening a HackRF.

Source

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

Open and configure the first visible HackRF.

Source

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

Open and configure a HackRF by its exact 128-bit serial.

Source

pub fn info(&self) -> &DeviceInfo

Return metadata collected while opening the device.

Source

pub fn config(&self) -> &Config

Return the configuration last successfully applied by this driver.

Source

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

Apply a complete validated transceiver configuration while off or streaming.

A live configuration change has no sample-accurate application boundary.

Source

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

Change the center frequency while the radio is off or streaming.

A live retune has no sample-accurate application boundary.

Source

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

Change the complex sample rate while the radio is off or streaming.

The driver also requests a baseband filter bandwidth equal to this rate. A live rate change has no sample-accurate application boundary.

Source

pub fn set_lna_gain_db( &mut self, gain_db: u8, ) -> impl MaybeFuture<Output = Result<()>> + '_

Set RX IF/LNA gain in dB while the radio is off or streaming.

A live gain change has no sample-accurate application boundary.

Source

pub fn set_vga_gain_db( &mut self, gain_db: u8, ) -> impl MaybeFuture<Output = Result<()>> + '_

Set baseband/VGA gain in dB while the radio is off or streaming.

A live gain change has no sample-accurate application boundary.

Source

pub fn set_tx_vga_gain_db( &mut self, gain_db: u8, ) -> impl MaybeFuture<Output = Result<()>> + '_

Set TX VGA gain in dB while the radio is off or streaming.

A live gain change has no sample-accurate application boundary.

Source

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

Enable or disable the RF amplifier while the radio is off or streaming.

A live amplifier change has no sample-accurate application boundary.

Source

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

Enable or disable antenna-port bias power while the radio is off or streaming.

A live bias-power change has no sample-accurate application boundary.

Source

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

Claim the device’s single owned receive stream.

The stream is initially stopped. Call RxStream::start before reading it and RxStream::stop before starting TX.

Source

pub fn tx_stream(&self) -> Result<TxStream>

Claim the device’s single owned transmit stream.

The stream is initially stopped. Call TxStream::start before writing it and TxStream::stop before starting RX.

Source

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

Put the transceiver in off mode and close the logical device session.

Returns Error::Busy unless both directions have been stopped. Once shutdown starts, streams can no longer be started. The session remains closed if the hardware request fails or its future is cancelled; drop this handle and reopen the device to try again. Dropping the handle performs best-effort cleanup on supported targets.

Trait Implementations§

Source§

impl Debug for Device

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Drop for Device

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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 = 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>,

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.