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<'a>( &'a mut self, config: &'a Config, ) -> impl MaybeFuture<Output = Result<()>> + 'a

Apply a complete validated RX configuration.

Source

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

Change the center frequency while stopped or receiving.

Source

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

Change the complex sample rate while stopped or receiving.

The driver also requests a baseband filter bandwidth equal to this rate.

Source

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

Set RX IF/LNA gain in dB.

Source

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

Set baseband/VGA gain in dB.

Source

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

Enable or disable the RF amplifier.

Source

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

Enable or disable antenna-port bias power.

HackRF firmware disables this when reception stops. A later stream start automatically reapplies the last successful setting.

Source

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

Claim the device’s single owned receive stream.

The stream starts dormant. The device remains usable for live setters while reception is active. Dropping the stream releases the claim.

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 while a receive stream is running. A stopped but still-owned stream does not prevent shutdown, but cannot be restarted.

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.