Addding enums to custom processing blocks

Hi,

What’s the process by which enums are added to the Python namespace via
SWIG in gnuradio? I mean in gr_firdes, the following are added to the
gr.firdes namespace in Python:

enum win_type {
WIN_HAMMING = 0, // max attenuation 53 dB
WIN_HANN = 1, // max attenuation 44 dB
WIN_BLACKMAN = 2, // max attenuation 74 dB
WIN_RECTANGULAR = 3,
WIN_KAISER = 4, // max attenuation variable with beta, google it
WIN_BLACKMAN_hARRIS = 5,
};

But I can’t seem to get it to work with my code?

Cheers,

John

On Tue, Sep 24, 2013 at 9:26 AM, John W. [email protected]
wrote:

WIN_RECTANGULAR = 3,
WIN_KAISER = 4,     // max attenuation variable with beta, google it
WIN_BLACKMAN_hARRIS = 5,

};

But I can’t seem to get it to work with my code?

Cheers,

John

Which version of GNU Radio are you using? That’ll make a difference on
how easy it is to set this up.

In 3.7, we declare the enum inside of the gr::filter namespace. In the
filter_swig.i file, the firdes.h header is included using both the C++
and Swig methods to makes sure everything in it is read and processed
properly.

%{
#include “gnuradio/filter/firdes.h”
%}

%include “gnnuradio/filter/firdes.h”

If you’re running 3.6, you can do similar. But check how gr_firdes.i
is written such that it redeclares the enum in SWIG.


Tom
GRCon13 Oct. 1 - 4
http://www.trondeau.com/grcon13

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