SoapySDR High Level API
SoapySDR.Channel
— TypeChannel
A channel on the given Device
.
Note!!: A Channel can be created from a Device
or extracted from a ChannelList
. It should rarely be necessary to create a Channel directly.
Has the following properties:
device::Device
-Device
to which theChannel
belongsdirection
- eitherTx
orRx
idx
- channel index used by Soapyinfo
- channel info consiting ofKWArgs
antenna
- antenna namegain_mode
- Automatic Gain control,true
,false
, ormissing
gain_elements
- list ofGainElements
of the channelgain
- effective gain, distributed amongst theGainElements
dc_offset_mode
- Automatic DC offset mode,true
,false
ormissing
dc_offset
- DC offset valueiq_balance_mode
- Automatic IQ balance mode,true
,false
ormissing
iq_balance
- IQ balance valuefrequency_correction
- frequency correction valuesample_rate
- sample ratebandwidth
- bandwidthfrequency
- center frequencyfullduplex
- full duplex mode with other (TX/RX) channelsnative_stream_format
- native stream formatstream_formats
- supported stream formats (converted by Soapy)fullscale
- full scale valuesensors
- sensor list
Reading and writing to Components
gains, antennas, and sensors may consist of a chain or selectable subcomponets. To set or read e.g. a sensors, one may use the following syntax:
dev = Devices()[1] cr = dev.rx[1]
read a sensor value
s1 = cr.sensors[1] cr[s1]
read and set the gain element
g1 = cr.gain_elements[1] cr[g1] cr[g1] = 4*u"dB"
read and set the frequency component
f1 = cr.frequency_components[1] cr[f1] cr[f1] = 2.498*u"GHz"
SoapySDR.ChannelList
— TypeChannelList
A grouping of channels on the Device. Note: This should not be called directly, but rather through the Device.rx and Device.tx properties.
SoapySDR.Device
— TypeDevice
A device is a collection of SDR channels, obtained from the Devices()
list.
Fields:
info
driver
hardware
tx
rx
sensors
time_source
time_sources
clock_source
clock_sources
frontendmapping_rx
frontendmapping_tx
SoapySDR.Devices
— TypeDevices()
Device(args...)
Enumerates all detectable SDR devices on the system. Indexing into the returned Devices
object returns a list of keywords used to create a Device
struct.
Optionally pass in a list of keywords to filter the returned list. Example:
Devices(driver="rtlsdr")
SoapySDR.Stream
— TypeSoapySDR.Stream(channels)
SoapySDR.Stream(::Type{T}, channels)
Constructs a Stream{T}
where T
is the stream type of the device. If unspecified, the native format will be used.
Fields:
- nchannels - The number of channels in the stream
- mtu - The stream Maximum Transmission Unit
- numdirectaccess_buffers - The numer of direct access buffers available in the stream
Example
SoapySDR.Stream(Devices()[1].rx)
Base.read!
— Methodread!(s::SoapySDR.Stream{T}, buffers::AbstractVector{AbstractVector{T}}; [timeout], [flags::Ref{Int}], [throw_error=false])
Read data from the device into the given buffers.
Base.read
— Methodread(s::SoapySDR.Stream{T}, nb::Integer; [timeout])
Read at most nb
samples from s
Base.setindex!
— MethodSet a register value on a device:
dev[SoapySDR.Register("LMS7002M")] = (0x1234, 0x5678) # tuple of: (addr, value)
dev[(SoapySDR.Register("LMS7002M"), 0x1234)] = 0x5678 # this is also equivalent, and symmetric to the getindex form to read
Base.write
— Methodwrite(s::SoapySDR.Stream{T}, buffer::AbstractVector{AbstractVector{T}}; [timeout], [flags::Ref{Int}], [throw_error=false]) where {N, T}
Write data from the given buffers into the device. The buffers must all be the same length.
SoapySDR.get_hardware_time
— Methodget_hardware_time(::Device, what::String)
Get hardware time for the given source.
SoapySDR.get_sensor_info
— Methodget_sensor_info(::Device, ::String)
Read the sensor extracted from list_sensors
. Returns: the value as a string. Note: Appropriate conversions need to be done by the user.
SoapySDR.has_hardware_time
— Methodhas_hardware_time(::Device, what::String)
Query if the Device has hardware time for the given source.
SoapySDR.list_sample_rates
— Methodlist_sample_rates(::Channel)
List the natively supported sample rates for a given channel.
SoapySDR.set_hardware_time
— Methodset_hardware_time(::Device, timeNs::Int64 what::String)
Set hardware time for the given source.