RTLSDRDevice

Struct RTLSDRDevice 

Source
pub struct RTLSDRDevice { /* private fields */ }

Implementations§

Source§

impl RTLSDRDevice

Source

pub fn close(&mut self) -> Result<(), RTLSDRError>

Close a previously opened RTL-SDR device.

Source

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.

Source

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).

Source

pub fn get_usb_strings(&mut self) -> Result<USBStrings, RTLSDRError>

Get USB strings for an opened device.

Source

pub fn set_center_freq(&mut self, frequency: u32) -> Result<(), RTLSDRError>

Set the RTL-SDR’s centre frequency (in Hz).

Source

pub fn get_center_freq(&mut self) -> Result<u32, RTLSDRError>

Get the RTL-SDR’s center frequency (in Hz).

Source

pub fn set_freq_correction(&mut self, ppm: i32) -> Result<(), RTLSDRError>

Set the RTL-SDR’s frequency correction (in ppm).

Source

pub fn get_freq_correction(&mut self) -> i32

Get the RTL-SDR’s current frequency correction (in ppm).

Source

pub fn get_tuner_type(&mut self) -> (i32, String)

Get the RTL-SDR’s tuner type.

Returns a tuple (id: i32, name: String).

Source

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.

Source

pub fn set_tuner_gain(&mut self, gain: i32) -> Result<(), RTLSDRError>

Set tuner gain (from list of allowable gains).

Source

pub fn get_tuner_gain(&mut self) -> i32

Get current tuner gain (in tenths of dB)

Source

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).

Source

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.

Source

pub fn set_sample_rate(&mut self, rate: u32) -> Result<(), RTLSDRError>

Set sample rate (in Hz).

Source

pub fn get_sample_rate(&mut self) -> Result<u32, RTLSDRError>

Get current sample rate (in Hz).

Source

pub fn set_tuner_bandwidth(&mut self, bw: u32) -> Result<(), RTLSDRError>

Set bandwidth (in Hz).

Source

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.

Source

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.

Source

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.

Source

pub fn get_direct_sampling(&mut self) -> Result<DirectSampling, RTLSDRError>

Get current direct sampling mode.

Source

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.

Source

pub fn get_offset_tuning(&mut self) -> Result<bool, RTLSDRError>

Get current offset tuning status.

Source

pub fn reset_buffer(&mut self) -> Result<(), RTLSDRError>

Reset streaming buffer.

Source

pub fn read_sync(&mut self, len: usize) -> Result<Vec<u8>, RTLSDRError>

Read a buffer synchronously.

Trait Implementations§

Source§

impl Drop for RTLSDRDevice

Source§

fn drop(&mut self)

Executes the destructor for this type. 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.