UHD Python API?

I’m not clear on this… if it’s in the UHD C++ API, does that
automatically mean it’s available in the Python API through SWIG? The
C++ API is fairly well documented but I haven’t found a good Python API
reference.

Thanks,
Sean

On 10/14/2011 02:53 PM, Nowlan, Sean wrote:

I’m not clear on this… if it’s in the UHD C++ API, does that
automatically mean it’s available in the Python API through SWIG? The
C++ API is fairly well documented but I haven’t found a good Python
API reference.

The API for the gr-uhd source and sink blocks is “swigged” into python.
Any calls you see in the source and sink header files will also be
available in python. You may want to start by generating some flow
graphs in grc and looking at the generated python code.

-josh

Thanks for your response. I’ve done that, but if want to do something
fancier like printing out daughterboard ID and device address, can I use
“swigged” C++ calls?

Can I use the following to get a pointer to the object instance and then
access the C++ public get/set methods? Or does SWIG not dig that deep?

virtual uhd::usrp::dboard_iface::sptr get_dboard_iface(size_t chan = 0)
= 0;
virtual uhd::usrp::multi_usrp::sptr get_device(void) = 0;

Sean

On 10/14/2011 03:04 PM, Nowlan, Sean wrote:

Can I use the following to get a pointer to the object instance and then access
the C++ public get/set methods? Or does SWIG not dig that deep?

Swig digs as deep as you tell it to. See uhd_swig.i, each header you
want to access stuff with needs a %include.

Keep in mind that that often means you need to add more %template and
other stuff. Swig is a picky beast, I have spent many hours trying to
appease it.

virtual uhd::usrp::dboard_iface::sptr get_dboard_iface(size_t chan = 0) = 0;

This has been swigged

virtual uhd::usrp::multi_usrp::sptr get_device(void) = 0;

This has not, %include “uhd/usrp/multi_usrp.hpp” may do the trick for
most of the calls you want.

-josh

I’m just trying to match old USRP driver functionality in some of the
gnuradio-examples, which probably requires additional SWIGging. Does
that sound about right?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs