libgs.hardware.GR_XMLRPCRadio

class libgs.hardware.GR_XMLRPCRadio(name, stream, rpcaddr, rpc_varmap={}, iqbufflen=1024, connect=True)[source]

Class for driving radios over RPC (mainly Gnu radio flowgraphs that include an XMLRPC block)

GNU radio flowgraphs with an XMLRPC block will expose all variables through get_<varname> and set_<varname> rpc calls.

This class uses those calls to set/get spectrum parameters and set/get the range_rate.

The flowgraph therefore needs to include variables for

  • range rate (in m/s)
  • centre frequency (in Hz)
  • bandwidth (in Hz)

They can be called anything as the variable names can be mapped using the rpc_varmap parameter.

Additionally, the flowgraph needs to publish the raw IQ samples (complex64 type) on a ZMQ port, which can be mapped using this class’s stream parameter

Parameters:
  • name (str) – A descriptive name for the radio
  • stream (str) – The IP:PORT on which to listen for published IQ samples
  • rpcaddr (str) – The RPC address (in format http://ip:port) to connect the XMLRPC proxy to
  • rpc_varmap (dict) – A dict mapping between freq, sample_rate and range_rate to whatever those variables are called in the Gnu Radio flowgraph.
  • iqbufflen (int) – Number of IQ samples to keep in circular buffer (for spectrum generation)
  • connect (bool) – If true connect immediately to Gnu Radio. Otherwise you need to call connect() separately.

Methods

connect() Connect to Gnu Radio ZMQ socket to receive IQ.
disconnect() Disconnect from GNU radio.
get_range_rate() Return the currently set range_rate
get_spectrum([old]) Return the latest spectrum from the radio as well as an associated frequency vecgor
set_range_rate(range_rate) Set frequency adjustment for a specific range_rate

Attributes

Inherited from base class

record_spectrum([dt, N, fdec, add_zeroes]) Record N spectra then return them.
err_range_rate_get
err_range_rate_set
name Getting/setting the radio name.
range_rate Property for getting/setting range_range using the get_range_rate()/set_range_rate() methods while also capturing any exception and storing it in err_range_rate.