Struct rtlsdr::Device [] [src]

pub struct Device {
    // some fields omitted
}

Methods

impl Device
[src]

fn close(&self) -> Error

Close the device.

fn set_xtal_freq(&self, rtl_freq_hz: i32, tuner_freq_hz: i32) -> Error

Sets the crystal oscillator frequencies.

Typically both ICs (rtlsdr and tuner) use the same clock. Changing the clock may make sense if you are applying an external clock to the tuner or to compensate the frequency (and sample rate) error caused by the original (cheap) crystal.

Note, call this function only if you fully understand the implications.

fn get_xtal_freq(&self) -> (i32, i32, Error)

Returns the crystal oscillator frequencies. Typically both ICs (rtlsdr and tuner) use the same clock.

fn get_usb_strings(&self) -> (String, String, String, Error)

Returns the device information (manufact, product, serial). Note, strings may be empty.

fn write_eeprom(&self, data: Vec<u8>, offset: u8) -> Error

Writes information data to the EEPROM.

fn read_eeprom(&self, offset: u8, len: u16) -> (Vec<u8>, Error)

Returns information data read from the EEPROM.

fn set_center_freq(&self, freq_hz: i32) -> Error

Sets the center frequency.

fn get_center_freq(&self) -> i32

Returns the tuned frequency or zero on error.

fn set_freq_correction(&self, ppm: i32) -> Error

Sets the frequency correction.

fn get_freq_correction(&self) -> i32

Returns the frequency correction value.

fn get_tuner_type(&self) -> String

Returns the tuner type.

fn get_tuner_gains(&self) -> (Vec<i32>, Error)

Returns a list of supported tuner gains. Values are in tenths of dB, e.g. 115 means 11.5 dB.

fn set_tuner_gain(&self, gain: i32) -> Error

Sets the tuner gain. Note, manual gain mode must be enabled for this to work. Valid gain values may be queried using get_tuner_gains.

Valid values (in tenths of a dB) are: -10, 15, 40, 65, 90, 115, 140, 165, 190, 215, 240, 290, 340, 420, 430, 450, 470, 490

Gain values are in tenths of dB, e.g. 115 means 11.5 dB.

fn get_tuner_gain(&self) -> i32

Returns the tuner gain.

Gain values are in tenths of dB, e.g. 115 means 11.5 dB.

fn set_tuner_bandwidth(&self, bw_hz: i32) -> Error

Sets the device bandwidth.

fn set_tuner_if_gain(&self, stage: i32, gains_tenths_db: i32) -> Error

Sets the intermediate frequency gain.

Intermediate frequency gain stage number 1 to 6. Gain values are in tenths of dB, e.g. -30 means -3.0 dB.

fn set_tuner_gain_mode(&self, manual_mode: bool) -> Error

Sets the gain mode, automatic or manual. Manual gain mode must be enabled for the gain setter function to work.

fn set_sample_rate(&self, rate_hz: i32) -> Error

Sets the sample rate.

When applicable, the baseband filters are also selected based on the requested sample rate.

fn get_sample_rate(&self) -> i32

Returns the sample rate.

fn set_testmode(&self, test_mode: bool) -> Error

Sets device to test mode.

Test mode returns 8 bit counters instead of samples. Note, the counter is generated inside the device.

fn set_agc_mode(&self, agc_mode: bool) -> Error

Sets the AGC mode.

fn set_direct_sampling(&self, mode: SamplingMode) -> Error

Sets the direct sampling mode.

When enabled, the IF mode of the device is activated, and set_center_freq() will control the IF-frequency of the DDC, which can be used to tune from 0 to 28.8 MHz (xtal frequency of the device).

fn get_direct_sampling(&self) -> SamplingMode

Returns the state of direct sampling mode.

fn set_offset_tuning(&self, enable: bool) -> Error

Sets the offset tuning mode for zero-IF tuners, which avoids problems caused by the DC offset of the ADCs and 1/f noise.

fn get_offset_tuning(&self) -> Error

Returns the offset tuning mode.

fn reset_buffer(&self) -> Error

Resets the streaming buffer.

fn read_sync(&self, len: i32) -> (Vec<u8>, i32, Error)

Performs a synchronous read of samples and returns the number of samples read.

fn read_async(&self, f: ReadAsyncCbT, ctx: *mut c_void, buf_num: i32, buf_len: i32) -> Error

Reads samples asynchronously. Note, this function will block until canceled using cancel_async. ReadAsyncCbT is a package global variable.

Optional buf_num buffer count, buf_num * buf_len = overall buffer size, set to 0 for default buffer count of 32.

Optional buf_len buffer length, must be multiple of 512, set to 0 for default buffer length of 262,144 (16 * 32 * 512).

fn cancel_async(&self) -> Error

Cancels all pending asynchronous operations.

fn get_hw_info(&self) -> (HwInfo, Error)

Gets the dongle's information items.

fn set_hw_info(&self, info: &HwInfo) -> Error

SetCenterFreq the dongle's information items.

Trait Implementations

impl Send for Device
[src]

impl Sync for Device
[src]

Derived Implementations

impl Clone for Device
[src]

fn clone(&self) -> Device

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Copy for Device
[src]