Struct rtlsdr::RTLSDRDevice
[−]
[src]
pub struct RTLSDRDevice { /* fields omitted */ }
Methods
impl RTLSDRDevice
[src]
fn close(&mut self) -> Result<(), RTLSDRError>
Close a previously opened RTL-SDR device.
fn set_xtal_freq(
&mut self,
rtl_freq: u32,
tuner_freq: u32
) -> Result<(), RTLSDRError>
&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.
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).
fn get_usb_strings(&mut self) -> Result<USBStrings, RTLSDRError>
Get USB strings for an opened device.
fn set_center_freq(&mut self, frequency: u32) -> Result<(), RTLSDRError>
Set the RTL-SDR's centre frequency (in Hz).
fn get_center_freq(&mut self) -> Result<u32, RTLSDRError>
Get the RTL-SDR's center frequency (in Hz).
fn set_freq_correction(&mut self, ppm: i32) -> Result<(), RTLSDRError>
Set the RTL-SDR's frequency correction (in ppm).
fn get_freq_correction(&mut self) -> i32
Get the RTL-SDR's current frequency correction (in ppm).
fn get_tuner_type(&mut self) -> (i32, String)
Get the RTL-SDR's tuner type.
Returns a tuple (id: i32, name: String).
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.
fn set_tuner_gain(&mut self, gain: i32) -> Result<(), RTLSDRError>
Set tuner gain (from list of allowable gains).
fn get_tuner_gain(&mut self) -> i32
Get current tuner gain (in tenths of dB)
fn set_tuner_if_gain(
&mut self,
stage: i32,
gain: i32
) -> Result<(), RTLSDRError>
&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).
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.
fn set_sample_rate(&mut self, rate: u32) -> Result<(), RTLSDRError>
Set sample rate (in Hz).
fn get_sample_rate(&mut self) -> Result<u32, RTLSDRError>
Get current sample rate (in Hz).
fn set_tuner_bandwidth(&mut self, bw: u32) -> Result<(), RTLSDRError>
Set bandwidth (in Hz).
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.
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.
fn set_direct_sampling(
&mut self,
mode: DirectSampling
) -> Result<(), RTLSDRError>
&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.
fn get_direct_sampling(&mut self) -> Result<DirectSampling, RTLSDRError>
Get current direct sampling mode.
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.
fn get_offset_tuning(&mut self) -> Result<bool, RTLSDRError>
Get current offset tuning status.
fn reset_buffer(&mut self) -> Result<(), RTLSDRError>
Reset streaming buffer.
fn read_sync(&mut self, len: usize) -> Result<Vec<u8>, RTLSDRError>
Read a buffer synchronously.