pub struct RTLSDRDevice { /* private fields */ }Implementations§
Source§impl RTLSDRDevice
impl RTLSDRDevice
Sourcepub fn close(&mut self) -> Result<(), RTLSDRError>
pub fn close(&mut self) -> Result<(), RTLSDRError>
Close a previously opened RTL-SDR device.
Sourcepub fn set_xtal_freq(
&mut self,
rtl_freq: u32,
tuner_freq: u32,
) -> Result<(), RTLSDRError>
pub fn set_xtal_freq( &mut self, rtl_freq: u32, tuner_freq: u32, ) -> Result<(), RTLSDRError>
Set crystal frequency (in Hz) for an opened device.
NOTE: Only do this if you know what you’re doing, for instance if you are injecting your own clock signal or correcting for the frequency of the onboard xtal. In general the RTL and the tuner will be fed from the same clock.
Sourcepub fn get_xtal_freq(&mut self) -> Result<(u32, u32), RTLSDRError>
pub fn get_xtal_freq(&mut self) -> Result<(u32, u32), RTLSDRError>
Get crystal frequency (in Hz) for an opened device.
Returns a tuple of (RTL freq, tuner freq).
Sourcepub fn get_usb_strings(&mut self) -> Result<USBStrings, RTLSDRError>
pub fn get_usb_strings(&mut self) -> Result<USBStrings, RTLSDRError>
Get USB strings for an opened device.
Sourcepub fn set_center_freq(&mut self, frequency: u32) -> Result<(), RTLSDRError>
pub fn set_center_freq(&mut self, frequency: u32) -> Result<(), RTLSDRError>
Set the RTL-SDR’s centre frequency (in Hz).
Sourcepub fn get_center_freq(&mut self) -> Result<u32, RTLSDRError>
pub fn get_center_freq(&mut self) -> Result<u32, RTLSDRError>
Get the RTL-SDR’s center frequency (in Hz).
Sourcepub fn set_freq_correction(&mut self, ppm: i32) -> Result<(), RTLSDRError>
pub fn set_freq_correction(&mut self, ppm: i32) -> Result<(), RTLSDRError>
Set the RTL-SDR’s frequency correction (in ppm).
Sourcepub fn get_freq_correction(&mut self) -> i32
pub fn get_freq_correction(&mut self) -> i32
Get the RTL-SDR’s current frequency correction (in ppm).
Sourcepub fn get_tuner_type(&mut self) -> (i32, String)
pub fn get_tuner_type(&mut self) -> (i32, String)
Get the RTL-SDR’s tuner type.
Returns a tuple (id: i32, name: String).
Sourcepub fn get_tuner_gains(&mut self) -> Result<Vec<i32>, RTLSDRError>
pub fn get_tuner_gains(&mut self) -> Result<Vec<i32>, RTLSDRError>
Get a Vec of allowable tuner gains.
Gains are specified in tenths-of-a-dB. The number of allowable gains depends on the attached hardware.
Sourcepub fn set_tuner_gain(&mut self, gain: i32) -> Result<(), RTLSDRError>
pub fn set_tuner_gain(&mut self, gain: i32) -> Result<(), RTLSDRError>
Set tuner gain (from list of allowable gains).
Sourcepub fn get_tuner_gain(&mut self) -> i32
pub fn get_tuner_gain(&mut self) -> i32
Get current tuner gain (in tenths of dB)
Sourcepub fn set_tuner_if_gain(
&mut self,
stage: i32,
gain: i32,
) -> Result<(), RTLSDRError>
pub fn set_tuner_if_gain( &mut self, stage: i32, gain: i32, ) -> Result<(), RTLSDRError>
Set tuner IF gain (in tenths of dB).
stage specifies which intermediate gain stage to set (1-6 for E4000).
Sourcepub fn set_tuner_gain_mode(&mut self, manual: bool) -> Result<(), RTLSDRError>
pub fn set_tuner_gain_mode(&mut self, manual: bool) -> Result<(), RTLSDRError>
Set automatic or manual gain.
Manual gain must be enabled for set_gain to work.
Sourcepub fn set_sample_rate(&mut self, rate: u32) -> Result<(), RTLSDRError>
pub fn set_sample_rate(&mut self, rate: u32) -> Result<(), RTLSDRError>
Set sample rate (in Hz).
Sourcepub fn get_sample_rate(&mut self) -> Result<u32, RTLSDRError>
pub fn get_sample_rate(&mut self) -> Result<u32, RTLSDRError>
Get current sample rate (in Hz).
Sourcepub fn set_tuner_bandwidth(&mut self, bw: u32) -> Result<(), RTLSDRError>
pub fn set_tuner_bandwidth(&mut self, bw: u32) -> Result<(), RTLSDRError>
Set bandwidth (in Hz).
Sourcepub fn set_test_mode(&mut self, enabled: bool) -> Result<(), RTLSDRError>
pub fn set_test_mode(&mut self, enabled: bool) -> Result<(), RTLSDRError>
Set test mode on or off.
Test mode turns on an 8 bit counter rather than sampling the radio input. The counter is generated inside the RTL2832.
Sourcepub fn set_agc_mode(&mut self, enabled: bool) -> Result<(), RTLSDRError>
pub fn set_agc_mode(&mut self, enabled: bool) -> Result<(), RTLSDRError>
Set AGC on or off.
Enables or disables the internal digital AGC of the RTL2832.
Sourcepub fn set_direct_sampling(
&mut self,
mode: DirectSampling,
) -> Result<(), RTLSDRError>
pub fn set_direct_sampling( &mut self, mode: DirectSampling, ) -> Result<(), RTLSDRError>
Set direct sampling.
When enabled, the IF mode of the RTL2832 is activated, and set_center_freq will control the IF frequency, allowing tuning from 0 to 28.8MHz.
Sourcepub fn get_direct_sampling(&mut self) -> Result<DirectSampling, RTLSDRError>
pub fn get_direct_sampling(&mut self) -> Result<DirectSampling, RTLSDRError>
Get current direct sampling mode.
Sourcepub fn set_offset_tuning(&mut self, enabled: bool) -> Result<(), RTLSDRError>
pub fn set_offset_tuning(&mut self, enabled: bool) -> Result<(), RTLSDRError>
Set offset tuning mode on/off. Only use on zero IF tuners.
Useful to avoid DC offsets and 1/f noise.
Sourcepub fn get_offset_tuning(&mut self) -> Result<bool, RTLSDRError>
pub fn get_offset_tuning(&mut self) -> Result<bool, RTLSDRError>
Get current offset tuning status.
Sourcepub fn reset_buffer(&mut self) -> Result<(), RTLSDRError>
pub fn reset_buffer(&mut self) -> Result<(), RTLSDRError>
Reset streaming buffer.