1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Native RTL2832U / R820T / R828D driver built on `nusb`.
//!
//! Device and stream operations can be awaited, or synchronously executed with
//! [`MaybeFuture::wait`] on native targets. Enable `smol` or `tokio` when awaiting
//! native discovery, opening, and endpoint setup; no runtime is required by the
//! blocking API. WebUSB supports awaiting only and requires
//! `--cfg=web_sys_unstable_apis` in the application's Rust flags.
//!
//! An independently owned [`RxStream`] keeps the hardware alive. Stop preserves
//! its exclusive claim; consuming close releases it. [`Device::shutdown`] is
//! terminal and returns [`Error::Busy`] until the stream has been closed/dropped.
//!
//! ```no_run
//! use rtlsdr_nusb::{Complex32, Device, MaybeFuture};
//! use std::time::Duration;
//!
//! let mut device = Device::builder()
//! .frequency_hz(100_000_000)
//! .sample_rate_hz(2_048_000)
//! .open().wait()?;
//! let mut rx = device.rx_stream()?;
//! rx.start().wait()?;
//! let mut samples = [Complex32::default(); 4096];
//! let count = rx.read(&mut samples, Some(Duration::from_secs(1))).wait()?;
//! println!("received {count} samples");
//! rx.close().wait()?;
//! device.shutdown().wait()?;
//! # Ok::<(), rtlsdr_nusb::Error>(())
//! ```
pub use ;
pub use ;
pub use DeviceDescriptor;
pub use ;
pub use Complex32;
pub use MaybeFuture;
pub use ;
pub use TunerKind;
// Compile the README examples as part of the documentation checks.