Requires libairspy at least 1.0.6 already built and installed on your system.
Tests require an attached Airspy (otherwise there is not much to test!) and
must be run with RUST_TEST_THREADS=1
or the threads may stomp on each other.
Simple usage example:
```rust extern crate airspy; use airspy::{Airspy,IQ}; use std::sync::mpsc;
// Open first available Airspy and configure for floating IQ samples, // 10Msps, 434MHz (can also set gains, AGC, RF bias etc). let mut dev = Airspy::new().unwrap(); dev.setsamplerate(0).unwrap(); dev.set_freq(434000000).unwrap();
// Samples are sent back to us from the C thread by an MPSC channel let (tx, rx) = mpsc::channel();
// Begin receiving data. Need the type hint either here or when creating the
// channel, which must match with the sample type selected earlier.
dev.start_rx::
// Blocking receive samples, stop after 10M. When the rx
object goes out of
// scope and is destroyed, the tx
detects the hangup and tells libairspy to
// stop data reception.
let mut nsamples = 0usize;
while dev.isstreaming() {
let samples = rx.recv().unwrap();
nsamples += samples.len() / 2;
println!("Got {} samples so far", nsamples);
if nsamples > 10000_000 {
break;
}
}
```
See src/bin/rx.rs
for a complete example of usage.