pub struct HackRf { /* private fields */ }Expand description
A HackRf device.
Implementations§
Source§impl HackRf
impl HackRf
Sourcepub fn device(&self) -> *mut HackrfDevice
pub fn device(&self) -> *mut HackrfDevice
Gets the internial representation of the HackRF device. This can be used with unsafe FFI functions if needed.
Sourcepub fn get_serial_number(&self) -> Result<SerialNumber>
pub fn get_serial_number(&self) -> Result<SerialNumber>
Gets the device serial number.
Sourcepub fn get_device_type(&self) -> Result<DeviceType>
pub fn get_device_type(&self) -> Result<DeviceType>
Read hackrf_board_id from a device and convert it to a DeviceType.
Sourcepub fn set_sample_rate(&self, sample_rate: u32) -> Result<()>
pub fn set_sample_rate(&self, sample_rate: u32) -> Result<()>
Sets the sample rate in Hz.
Sourcepub fn set_amp_enable(&self, enable: bool) -> Result<()>
pub fn set_amp_enable(&self, enable: bool) -> Result<()>
Sets the state of the externial amplifier.
Sourcepub fn set_lna_gain(&self, gain: u32) -> Result<()>
pub fn set_lna_gain(&self, gain: u32) -> Result<()>
Low noise amplifier gain. Between 0d and 40d in steps of 8dB.
Sourcepub fn set_rxvga_gain(&self, gain: u32) -> Result<()>
pub fn set_rxvga_gain(&self, gain: u32) -> Result<()>
Variable gain amplifier. Range 0-62 (step 2dB).
Sourcepub fn set_txvga_gain(&self, gain: u32) -> Result<()>
pub fn set_txvga_gain(&self, gain: u32) -> Result<()>
Transmit variable gain amplifier. Range 0-47 (step 1dB).
pub fn set_baseband_filter_bandwidth(&self, bandwidth_hz: u32) -> Result<()>
Sourcepub fn start_tx(
&self,
callback: fn(hack_rf: &HackRf, samples: &mut [Complex<i8>], user: &dyn Any),
user_data: impl Any,
) -> Result<()>
pub fn start_tx( &self, callback: fn(hack_rf: &HackRf, samples: &mut [Complex<i8>], user: &dyn Any), user_data: impl Any, ) -> Result<()>
Starts transmitting samples from the device.
Sourcepub fn start_rx(
&self,
callback: fn(hack_rf: &HackRf, samples: &[Complex<i8>], user: &dyn Any),
user_data: impl Any + Sync,
) -> Result<()>
pub fn start_rx( &self, callback: fn(hack_rf: &HackRf, samples: &[Complex<i8>], user: &dyn Any), user_data: impl Any + Sync, ) -> Result<()>
Starts receiving samples from the device.
Sourcepub fn is_streaming(&self) -> bool
pub fn is_streaming(&self) -> bool
Returns true if the device is currently streaming samples (transmitting or receiving).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HackRf
impl RefUnwindSafe for HackRf
impl Send for HackRf
impl Sync for HackRf
impl Unpin for HackRf
impl UnwindSafe for HackRf
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
Mutably borrows from an owned value. Read more