SDRDriverBase#
- class SDRDriverBase[source]#
Bases:
ABCContract every vendor SDR driver implements.
Abstract methods cover what every radio can do: open, tune, set a rate, and return samples. The rest raise
NotImplementedErrorby default, and a driver overrides only those its hardware supports. A driver owns its own transport and holds no reference back toInstroSDR.Configuration methods take keyword-only
directionandchannel, defaulting to the first receive path. Acquisition (read_iq,fetch_iq,get_backlog) is receive-only.Example
A receive-only, single-channel driver over a vendor SDK:
class MyVendorSDR(SDRDriverBase): def __init__(self, device_index: int = 0): self._device_index = device_index self._device = None def open(self) -> None: from vendor_sdk import Radio # keeps the SDK optional at import time self._device = Radio(self._device_index) def close(self) -> None: self._device.close() def set_center_freq(self, frequency_hz, *, direction=Direction.RX, channel="0"): self._device.center_freq = frequency_hz ... # get_center_freq, set_sample_rate, get_sample_rate def read_iq(self, n_samples, *, channels=("0",)) -> IQCapture: samples = np.asarray(self._device.read_samples(n_samples), dtype=np.complex128) return IQCapture( samples=samples.reshape(1, -1), sample_period_ns=1e9 / self._device.sample_rate, channels=("0",), center_freq_hz=(self._device.center_freq,), )
Methods
Close the underlying transport or SDR handle. |
|
Return the next contiguous block from the receive stream, blocking until it is available. |
|
Return the selected antenna port. |
|
Return how many samples are waiting to be fetched from the receive stream. |
|
Return the IF or filter bandwidth. |
|
Return the RF center frequency the radio is tuned to. |
|
Return the reference oscillator correction. |
|
Return the lowest and highest tunable center frequency. |
|
Return the overall gain. |
|
Report whether automatic gain control is in control. |
|
Return the lowest and highest settable gain. |
|
Return the number of signal paths in a direction. |
|
Return the IQ sample rate the radio accepted. |
|
Return the lowest and highest settable sample rate. |
|
List the selectable antenna ports. |
|
Open the underlying transport or SDR handle. |
|
Read one time-aligned receive block, with the timebase it was taken on. |
|
Select an antenna port. |
|
Set the IF or filter bandwidth. |
|
Tune the RF center frequency. |
|
Correct the reference oscillator's frequency error. |
|
Set the overall gain. |
|
Hand gain to the radio's automatic gain control, or take manual control. |
|
Set the IQ sample rate. |
|
Begin continuous acquisition. |
|
End a direction's stream and release its buffers. |