SoapySDR High Level API

SoapySDR.ChannelType
Channel

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 the Channel belongs
  • direction - either Tx or Rx
  • idx - channel index used by Soapy
  • info - channel info consiting of KWArgs
  • antenna - antenna name
  • gain_mode - Automatic Gain control, true, false, or missing
  • gain_elements - list of GainElements of the channel
  • gain - effective gain, distributed amongst the GainElements
  • dc_offset_mode - Automatic DC offset mode, true, false or missing
  • dc_offset - DC offset value
  • iq_balance_mode - Automatic IQ balance mode, true, false or missing
  • iq_balance - IQ balance value
  • frequency_correction - frequency correction value
  • sample_rate - sample rate
  • bandwidth - bandwidth
  • frequency - center frequency
  • fullduplex - full duplex mode with other (TX/RX) channels
  • native_stream_format - native stream format
  • stream_formats - supported stream formats (converted by Soapy)
  • fullscale - full scale value
  • sensors - 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"

source
SoapySDR.ChannelListType
ChannelList

A grouping of channels on the Device. Note: This should not be called directly, but rather through the Device.rx and Device.tx properties.

source
SoapySDR.DeviceType
Device

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
source
SoapySDR.DevicesType
Devices()
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")
source
SoapySDR.StreamType
SoapySDR.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)
source
Base.read!Method
read!(s::SoapySDR.Stream{T}, buffers::AbstractVector{AbstractVector{T}}; [timeout], [flags::Ref{Int}], [throw_error=false])

Read data from the device into the given buffers.

source
Base.readMethod
read(s::SoapySDR.Stream{T}, nb::Integer; [timeout])

Read at most nb samples from s

source
Base.setindex!Method

Set 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
source
Base.writeMethod
write(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.

source
SoapySDR.get_sensor_infoMethod
get_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.

source