pub struct Device { /* private fields */ }Expand description
High-level owned HackRF device handle.
Implementations§
Source§impl Device
impl Device
Sourcepub fn list() -> impl MaybeFuture<Output = Result<Vec<DeviceDescriptor>>>
pub fn list() -> impl MaybeFuture<Output = Result<Vec<DeviceDescriptor>>>
List visible normal-mode HackRF devices without claiming them.
Sourcepub fn builder() -> DeviceBuilder
pub fn builder() -> DeviceBuilder
Start building and opening a HackRF.
Sourcepub fn open() -> impl MaybeFuture<Output = Result<Self>>
pub fn open() -> impl MaybeFuture<Output = Result<Self>>
Open and configure the first visible HackRF.
Sourcepub fn open_serial(serial: u128) -> impl MaybeFuture<Output = Result<Self>>
pub fn open_serial(serial: u128) -> impl MaybeFuture<Output = Result<Self>>
Open and configure a HackRF by its exact 128-bit serial.
Sourcepub fn info(&self) -> &DeviceInfo
pub fn info(&self) -> &DeviceInfo
Return metadata collected while opening the device.
Sourcepub fn config(&self) -> &Config
pub fn config(&self) -> &Config
Return the configuration last successfully applied by this driver.
Sourcepub fn configure(
&mut self,
config: &Config,
) -> impl MaybeFuture<Output = Result<()>> + '_
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.
Sourcepub fn set_frequency_hz(
&mut self,
frequency_hz: u64,
) -> impl MaybeFuture<Output = Result<()>> + '_
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.
Sourcepub fn set_sample_rate_hz(
&mut self,
sample_rate_hz: u32,
) -> impl MaybeFuture<Output = Result<()>> + '_
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.
Sourcepub fn set_lna_gain_db(
&mut self,
gain_db: u8,
) -> impl MaybeFuture<Output = Result<()>> + '_
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.
Sourcepub fn set_vga_gain_db(
&mut self,
gain_db: u8,
) -> impl MaybeFuture<Output = Result<()>> + '_
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.
Sourcepub fn set_tx_vga_gain_db(
&mut self,
gain_db: u8,
) -> impl MaybeFuture<Output = Result<()>> + '_
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.
Sourcepub fn set_amp_enable(
&mut self,
enabled: bool,
) -> impl MaybeFuture<Output = Result<()>> + '_
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.
Sourcepub fn set_bias_tee(
&mut self,
enabled: bool,
) -> impl MaybeFuture<Output = Result<()>> + '_
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.
Sourcepub fn rx_stream(&self) -> Result<RxStream>
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.
Sourcepub fn tx_stream(&self) -> Result<TxStream>
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.
Sourcepub fn shutdown(&mut self) -> impl MaybeFuture<Output = Result<()>> + '_
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.