![]() |
SoapySDR
0.1.0
Vendor and platform neutral SDR interface library
|
#include <Device.hpp>
Public Member Functions | |
virtual | ~Device (void) |
virtual destructor for inheritance More... | |
virtual std::string | getDriverKey (void) const |
virtual std::string | getHardwareKey (void) const |
virtual Kwargs | getHardwareInfo (void) const |
virtual void | setFrontendMapping (const int direction, const std::string &mapping) |
virtual std::string | getFrontendMapping (const int direction) const |
virtual size_t | getNumChannels (const int direction) const |
virtual bool | getFullDuplex (const int direction, const size_t channel) const |
virtual Stream * | setupStream (const int direction, const std::string &format, const std::vector< size_t > &channels=std::vector< size_t >(), const Kwargs &args=Kwargs()) |
virtual void | closeStream (Stream *stream) |
virtual int | activateStream (Stream *stream, const int flags=0, const long long timeNs=0, const size_t numElems=0) |
virtual int | deactivateStream (Stream *stream, const int flags=0, const long long timeNs=0) |
virtual int | readStream (Stream *stream, void *const *buffs, const size_t numElems, int &flags, long long &timeNs, const long timeoutUs=100000) |
virtual int | writeStream (Stream *stream, const void *const *buffs, const size_t numElems, int &flags, const long long timeNs=0, const long timeoutUs=100000) |
virtual std::vector< std::string > | listAntennas (const int direction, const size_t channel) const |
virtual void | setAntenna (const int direction, const size_t channel, const std::string &name) |
virtual std::string | getAntenna (const int direction, const size_t channel) const |
virtual void | setDCOffsetMode (const int direction, const size_t channel, const bool automatic) |
virtual bool | getDCOffsetMode (const int direction, const size_t channel) const |
virtual void | setDCOffset (const int direction, const size_t channel, const std::complex< double > &offset) |
virtual std::complex< double > | getDCOffset (const int direction, const size_t channel) const |
virtual void | setIQBalance (const int direction, const size_t channel, const std::complex< double > &balance) |
virtual std::complex< double > | getIQBalance (const int direction, const size_t channel) const |
virtual std::vector< std::string > | listGains (const int direction, const size_t channel) const |
virtual void | setGainMode (const int direction, const size_t channel, const bool automatic) |
virtual bool | getGainMode (const int direction, const size_t channel) const |
virtual void | setGain (const int direction, const size_t channel, const double value) |
virtual void | setGain (const int direction, const size_t channel, const std::string &name, const double value) |
virtual double | getGain (const int direction, const size_t channel) const |
virtual double | getGain (const int direction, const size_t channel, const std::string &name) const |
virtual Range | getGainRange (const int direction, const size_t channel) const |
virtual Range | getGainRange (const int direction, const size_t channel, const std::string &name) const |
virtual void | setFrequency (const int direction, const size_t channel, const double frequency, const Kwargs &args=Kwargs()) |
virtual double | getFrequency (const int direction, const size_t channel) const |
virtual double | getFrequency (const int direction, const size_t channel, const std::string &name) const |
virtual std::vector< std::string > | listFrequencies (const int direction, const size_t channel) const |
virtual RangeList | getFrequencyRange (const int direction, const size_t channel) const |
virtual void | setSampleRate (const int direction, const size_t channel, const double rate) |
virtual double | getSampleRate (const int direction, const size_t channel) const |
virtual std::vector< double > | listSampleRates (const int direction, const size_t channel) const |
virtual void | setBandwidth (const int direction, const size_t channel, const double bw) |
virtual double | getBandwidth (const int direction, const size_t channel) const |
virtual std::vector< double > | listBandwidths (const int direction, const size_t channel) const |
virtual void | setMasterClockRate (const double rate) |
virtual double | getMasterClockRate (void) const |
virtual std::vector< std::string > | listClockSources (void) const |
virtual void | setClockSource (const std::string &source) |
virtual std::string | getClockSource (void) const |
virtual std::vector< std::string > | listTimeSources (void) const |
virtual void | setTimeSource (const std::string &source) |
virtual std::string | getTimeSource (void) const |
virtual bool | hasHardwareTime (const std::string &what="") const |
virtual long long | getHardwareTime (const std::string &what="") const |
virtual void | setHardwareTime (const long long timeNs, const std::string &what="") |
virtual void | setCommandTime (const long long timeNs, const std::string &what="") |
virtual std::vector< std::string > | listSensors (void) const |
virtual std::string | readSensor (const std::string &name) const |
virtual void | writeRegister (const unsigned addr, const unsigned value) |
virtual unsigned | readRegister (const unsigned addr) const |
virtual void | writeSetting (const std::string &key, const std::string &value) |
virtual std::string | readSetting (const std::string &key) const |
virtual std::vector< std::string > | listGPIOBanks (void) const |
virtual void | writeGPIO (const std::string &bank, const unsigned value) |
virtual unsigned | readGPIO (const std::string &bank) const |
virtual void | writeI2C (const int addr, const std::string &data) |
virtual std::string | readI2C (const int addr, const size_t numBytes) |
virtual unsigned | transactSPI (const int addr, const unsigned data, const size_t numBits) |
virtual std::vector< std::string > | listUARTs (void) const |
virtual void | writeUART (const std::string &which, const std::string &data) |
virtual std::string | readUART (const std::string &which, const long timeoutUs=100000) const |
Static Public Member Functions | |
static std::vector< Kwargs > | enumerate (const Kwargs &args=Kwargs()) |
static std::vector< Kwargs > | enumerate (const std::string &args) |
static Device * | make (const Kwargs &args=Kwargs()) |
static Device * | make (const std::string &args) |
static void | unmake (Device *device) |
Abstraction for an SDR tranceiver device - configuration and streaming.
|
virtual |
virtual destructor for inheritance
|
virtual |
Activate a stream. Call activate to prepare a stream before using read/write(). The implementation control switches or stimulate data flow.
The timeNs is only valid when the flags have SOAPY_SDR_HAS_TIME. The numElems count can be used to request a finite burst size. The SOAPY_SDR_END_BURST flag can signal end on the finite burst. Not all implementations will support the full range of options. In this case, the implementation returns SOAPY_SDR_NOT_SUPPORTED.
stream | the opaque pointer to a stream handle |
flags | optional flag indicators about the stream |
timeNs | optional activation time in nanoseconds |
numElems | optional element count for burst control |
|
virtual |
Close an open stream created by setupStream The implementation may change switches or power-down components.
stream | the opaque pointer to a stream handle |
|
virtual |
Deactivate a stream. Call deactivate when not using using read/write(). The implementation control switches or halt data flow.
The timeNs is only valid when the flags have SOAPY_SDR_HAS_TIME. Not all implementations will support the full range of options. In this case, the implementation returns SOAPY_SDR_NOT_SUPPORTED.
stream | the opaque pointer to a stream handle |
flags | optional flag indicators about the stream |
timeNs | optional deactivation time in nanoseconds |
Enumerate a list of available devices on the system.
args | device construction key/value argument filters |
|
static |
Enumerate a list of available devices on the system. Markup format for args: "keyA=valA, keyB=valB".
args | a markup string of key/value argument filters |
|
virtual |
Get the selected antenna on a chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the baseband filter width of the chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the clock source of the device
|
virtual |
Get the frontend DC offset correction.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the automatic DC offset corrections mode.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
A key that uniquely identifies the device driver. This key identifies the underlying implementation. Serveral variants of a product may share a driver.
|
virtual |
Get the center frequency of the chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the frequency of a tunable element in the chain. Recommended names used to represent tunable components:
direction | the channel direction RX or TX |
channel | an available channel on the device |
name | the name of an frequency component |
|
virtual |
Get the range of possible frequency values.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the mapping configuration string.
direction | the channel direction RX or TX |
the | vendor-specific mapping string |
|
virtual |
Find out if the specified channel is full or half duplex.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the overall value of the gain elements in a chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the value of an individual amplification element in a chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
name | the name of an amplification element |
|
virtual |
Get the automatic gain mode on the chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the overall range of possible gain values.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the range of possible gain values for a specific element.
direction | the channel direction RX or TX |
channel | an available channel on the device |
name | the name of an amplification element |
|
virtual |
Query a dictionary of available device information. This dictionary can any number of values like vendor name, product name, revisions, serials... This information can be displayed to the user to help identify the instantiated device.
|
virtual |
A key that uniquely identifies the hardware. This key should be meaningful to the user to optimize for the underlying hardware.
|
virtual |
Read the time from the hardware clock on the device. The what argument can refer to a specific time counter.
what | optional argument |
|
virtual |
Get the frontend IQ balance correction.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the master clock rate of the device.
|
virtual |
Get a number of channels given the streaming direction
|
virtual |
Get the baseband sample rate of the chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the time source of the device
|
virtual |
Does this device have a hardware clock?
what | optional argument |
|
virtual |
Get a list of available antennas to select on a given chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the range of possible baseband filter widths.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
Get the list of available clock sources.
|
virtual |
List available tunable elements in the chain.
direction | the channel direction RX or TX |
channel | an available channel |
|
virtual |
List available amplification elements.
direction | the channel direction RX or TX |
channel | an available channel |
|
virtual |
Get a list of available GPIO banks by name.
|
virtual |
Get the range of possible baseband sample rates.
direction | the channel direction RX or TX |
channel | an available channel on the device |
|
virtual |
List the available readback sensors. A sensor can represent a reference lock, RSSI, temperature.
|
virtual |
Get the list of available time sources.
|
virtual |
Enumerate the available UART devices.
Make a new Device object given device construction args. The device pointer will be stored in a table so subsequent calls with the same arguments will produce the same device. For every call to make, there should be a matched call to unmake.
args | device construction key/value argument map |
|
static |
Make a new Device object given device construction args. The device pointer will be stored in a table so subsequent calls with the same arguments will produce the same device. For every call to make, there should be a matched call to unmake.
args | a markup string of key/value arguments |
|
virtual |
Readback the value of a GPIO bank.
bank | the name of an available bank |
|
virtual |
Read from an available I2C slave. If the device contains multiple I2C masters, the address bits can encode which master.
addr | the address of the slave |
numBytes | the number of bytes to read |
|
virtual |
Read a register on the device.
addr | the register address |
|
virtual |
Readback a sensor given the name. The value returned is a string which can represent a boolean ("true"/"false"), an integer, or float.
name | the name of an available sensor |
|
virtual |
Read an arbitrary setting on the device.
key | the setting identifier |
|
virtual |
Read elements from a stream for reception. This is a multi-channel call, and buffs should be an array of void *, where each pointer will be filled with data from a different channel.
stream | the opaque pointer to a stream handle |
buffs | an array of void* buffers num chans in size |
numElems | the number of elements in each buffer |
flags | optional flag indicators about the result |
timeNs | the buffer's timestamp in nanoseconds |
timeoutUs | the timeout in microseconds |
|
virtual |
Read bytes from a UART until timeout or newline. Its up to the implementation to set the baud rate, carriage return settings, flushing on newline.
which | the name of an available UART |
timeoutUs | a timeout in microseconds |
|
virtual |
Set the selected antenna on a chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
name | the name of an available antenna |
|
virtual |
Set the baseband filter width of the chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
bw | the baseband filter width in Hz |
|
virtual |
Set the clock source on the device
source | the name of a clock source |
|
virtual |
Set the time of subsequent configuration calls. The what argument can refer to a specific command queue. Implementations may use a time of 0 to clear.
timeNs | time in nanoseconds |
what | optional argument |
|
virtual |
Set the frontend DC offset correction.
direction | the channel direction RX or TX |
channel | an available channel on the device |
offset | the relative correction (1.0 max) |
|
virtual |
Set the automatic DC offset corrections mode.
direction | the channel direction RX or TX |
channel | an available channel on the device |
automatic | true for automatic offset correction |
|
virtual |
Set the center frequency of the chain. Recommended keys to use in the args dictionary:
direction | the channel direction RX or TX |
channel | an available channel on the device |
frequency | the center frequency in Hz |
args | optional tuner arguments |
|
virtual |
Set the frontend mapping of available DSP units to RF frontends. This mapping controls channel mapping and channel availability.
direction | the channel direction RX or TX |
mapping | a vendor-specific mapping string |
|
virtual |
Set the overall amplification in a chain. The gain will be distributed automatically across available element.
direction | the channel direction RX or TX |
channel | an available channel on the device |
name | the name of an amplification element |
value | the new amplification value in dB |
|
virtual |
Set the value of a amplification element in a chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
name | the name of an amplification element |
value | the new amplification value in dB |
|
virtual |
Set the automatic gain mode on the chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
automatic | true for automatic gain setting |
|
virtual |
Write the time to the hardware clock on the device. The what argument can refer to a specific time counter.
timeNs | time in nanoseconds |
what | optional argument |
|
virtual |
Set the frontend IQ balance correction.
direction | the channel direction RX or TX |
channel | an available channel on the device |
balance | the relative correction (1.0 max) |
|
virtual |
Set the master clock rate of the device.
rate | the clock rate in Hz |
|
virtual |
Set the baseband sample rate of the chain.
direction | the channel direction RX or TX |
channel | an available channel on the device |
rate | the sample rate in samples per second |
|
virtual |
Set the time source on the device
source | the name of a time source |
|
virtual |
Initialize a stream given a list of channels and stream arguments. The implementation may change switches or power-up components.
Format string markup guidelines:
Example format strings:
Recommended keys to use in the args dictionary:
direction | the channel direction RX or TX |
format | the desired buffer format in read/writeStream() |
channels | a list of channels for empty for automatic |
args | stream args or empty for defaults |
|
virtual |
Perform a SPI transaction and return the result. Its up to the implementation to set the clock rate, and read edge, and the write edge of the SPI core. SPI slaves without a readback pin will return 0.
If the device contains multiple SPI masters, the address bits can encode which master.
addr | an address of an available SPI slave |
data | the SPI data, numBits-1 is first out |
numBits | the number of bits to clock out |
|
static |
Unmake or release a device object handle.
device | a pointer to a device object |
|
virtual |
Write the value of a GPIO bank.
bank | the name of an available bank |
value | an integer representing GPIO bits |
|
virtual |
Write to an available I2C slave. If the device contains multiple I2C masters, the address bits can encode which master.
addr | the address of the slave |
data | an array of bytes write out |
|
virtual |
Write a register on the device. This can represent a register on a soft CPU, FPGA, IC; the interpretation is up the implementation to decide.
addr | the register address |
value | the register value |
|
virtual |
Write an arbitrary setting on the device. The interpretation is up the implementation.
key | the setting identifier |
value | the setting value |
|
virtual |
Write elements to a stream for transmission. This is a multi-channel call, and buffs should be an array of void *, where each pointer will be filled with data for a different channel.
stream | the opaque pointer to a stream handle |
buffs | an array of void* buffers num chans in size |
numElems | the number of elements in each buffer |
flags | optional input flags and output flags |
timeNs | the buffer's timestamp in nanoseconds |
timeoutUs | the timeout in microseconds |
|
virtual |
Write data to a UART device. Its up to the implementation to set the baud rate, carriage return settings, flushing on newline.
which | the name of an available UART |
data | an array of bytes to write out |