discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Correct way to add constructor parameter


From: Ron Economos
Subject: Re: [Discuss-gnuradio] Correct way to add constructor parameter
Date: Wed, 6 Jun 2018 09:28:32 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

You have to add the variable in the <make>.....</make> line of the .xml file.

Ron

On 06/06/2018 09:08 AM, Sumit Kumar wrote:


I am adding additional option in a GRC block. Its Soft Frame Equalizer



As you see in the figure, the block has options for Algorithm, Frequency, Bandwidth, Log and Debug. I added my own variable "Scaling".

For this, first I edited in soft_frame_equalizer_impl.cc as follows :

soft_frame_equalizer::sptr
soft_frame_equalizer::make(Equalizer_soft algo, double freq, double bw, int scaling, bool log, bool debug) {
    return gnuradio::get_initial_sptr
        (new soft_frame_equalizer_impl(algo, freq, bw, scaling, log, debug));
}


soft_frame_equalizer_impl::soft_frame_equalizer_impl(Equalizer_soft algo, double freq, double bw, int scaling, bool log, bool debug) :
    gr::block("soft_frame_equalizer",
            gr::io_signature::make(1, 1, 64 * sizeof(gr_complex)),
            gr::io_signature::make2(2, 2, 48, 48 * sizeof(float))),
    d_current_symbol(0), d_log(log), d_debug(debug), d_equalizer(NULL),
    d_freq(freq), d_bw(bw), d_scaling(scaling), d_frame_bytes(0), d_frame_symbols(0),
    d_freq_offset_from_synclong(0.0)

void
soft_frame_equalizer_impl::set_scaling(int scaling) {
    d_scaling = scaling;
}

And then in soft_frame_equalizer_impl.h as follows :

public:
    soft_frame_equalizer_impl(Equalizer_soft algo, double freq, double bw, int scaling, bool log, bool debug);
    ~soft_frame_equalizer_impl();

    void set_algorithm(Equalizer_soft algo);
    void set_bandwidth(double bw);
    void set_frequency(double freq);
    void set_scaling(int scaling);

private:

int d_scaling;

And then in soft_frame_equalizer.h from the include directory as follows :

public:
    typedef boost::shared_ptr<soft_frame_equalizer> sptr;
    static sptr make(Equalizer_soft algo, double freq, double bw, int scaling,
            bool log, bool debug);
    virtual void set_algorithm(Equalizer_soft algo) = 0;
    virtual void set_bandwidth(double bw) = 0;
    virtual void set_frequency(double freq) = 0;
    virtual void set_scaling(int scaling) = 0;

And finally in the xml file as follows :

    <param>
        <name>Scaling</name>
        <key>scaling</key>
        <value>0</value>
        <type>real</type>
    </param>

It compiles well, but when I execute the program, it throws following error:

sender started
Traceback (most recent call last):
  File "/home/john/myprefix/src/gr-ieee-80211/examples/soft_decision_receiver_simulator_under_interference.py", line 569, in <module>
    main()
  File "/home/john/myprefix/src/gr-ieee-80211/examples/soft_decision_receiver_simulator_under_interference.py", line 557, in main
    tb = top_block_cls(bandwidth=options.bandwidth, encoding=options.encoding, frequency=options.frequency, sensitivity=options.sensitivity)
  File "/home/john/myprefix/src/gr-ieee-80211/examples/soft_decision_receiver_simulator_under_interference.py", line 282, in __init__
    self.ieee802_11_soft_frame_equalizer_0 = ieee802_11.soft_frame_equalizer(ieee802_11.LS, 2.437e9, 20e6, False, False)
  File "/home/john/myprefix/lib/python2.7/dist-packages/ieee802_11/ieee802_11_swig.py", line 644, in make
    return _ieee802_11_swig.soft_frame_equalizer_make(*args, **kwargs)
TypeError: Required argument 'debug' (pos 6) not found

What I am missing ? Where else I need to edit ?

Regards
Sumit


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

[Prev in Thread] Current Thread [Next in Thread]