Error when calling method of base class block

Hi all guys,

I am making a file sink block with limited number of elements allowed to
be
written in a file. I coded my block in the same way as it was done in
file_sink block found in blocks module. Namely, I derived my block from
file_sink_base and gr_sync_block, and so on, the rest is copied from the
existing block and finally the work function is slightly changed.
Unfortunately I am not able to call methods inherited from
file_sink_base
class. I believe it is swig issue but don’t know how to make it. The
error
that I get when calling close() method inside my test:

1: Test timeout computed to be: 9.99988e+06
1: thread[thread-per-block[1]: <gr_block file_sink_lim_b (2)>]:
gr_block_detail::n_output_items
1: thread[thread-per-block[1]: <gr_block file_sink_lim_b (5)>]:
gr_block_detail::n_output_items
1: E
1:

1: ERROR: test_001_t (main.qa_file_sink_lim_b)
1:

1: Traceback (most recent call last):
1: File
“/home/savi_ne/work/gnuradio/gr-TPMS/python/qa_file_sink_lim_b.py”, line
44, in test_001_t
1: self.dst.close()
1: AttributeError: ‘file_sink_lim_b_sptr’ object has no attribute
‘close’
1:

I use gnuradio 3.6.5.1 version.

What do your swig file changes look like?

M

Hello,

well after a lot of digging in the mailing list I added this into my
swig.i
file:

%include “gnuradio/blocks/file_sink_base.h”

and I also added this into my CMakeLists.txt:

set(GR_REQUIRED_COMPONENTS BLOCKS)

It turned out that only first change is required.

Best and hope that this will help somebody in the future.

Nemanja

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