Sunday, January 20, 2019

[Discuss-gnuradio] help with OOT module header_format_base child

hi all
i created a "noblock" OOT module
child class of header_format_base
no XML installed (edited the Cmakelists file in grc folder)
compilation OK
installation OK
nm -C -u lib-*** OK
python import OK

in top_block.py i have these lines :
self.hdr_format = hdr_format =
f4gsw.header_format_cc1101('1101001110010001', 0,1)
...
self.digital_protocol_formatter_async_0 =
digital.protocol_formatter_async(hdr_format)

but i still get this error at runtime :
Traceback (most recent call last):
File "top_block.py", line 124, in <module>
main()
File "top_block.py", line 112, in main
tb = top_block_cls()
File "top_block.py", line 74, in __init__
self.digital_protocol_formatter_async_0 =
digital.protocol_formatter_async(hdr_format)
File "/usr/lib/python2.7/dist-packages/gnuradio/digital/digital_swig2.py",
line 1242, in make
return _digital_swig2.protocol_formatter_async_make(format)
TypeError: in method 'protocol_formatter_async_make', argument 1 of
type 'gr::digital::header_format_base::sptr const &'

and if i write:
self.digital_protocol_formatter_async_0 =
digital.protocol_formatter_async(hdr_format.base())

i get the error :
Traceback (most recent call last):
File "top_block.py", line 124, in <module>
main()
File "top_block.py", line 112, in main
tb = top_block_cls()
File "top_block.py", line 74, in __init__
self.digital_protocol_formatter_async_0 =
digital.protocol_formatter_async(hdr_format.base())
AttributeError: 'header_format_cc1101' object has no attribute 'base'


i you look at my c++ code below
i did neither redefine the "sptr" member nor the base() method in the
child class
because i read nothing about that in the comments in the
header_format_base.h file



****************************************************************
head of header_format_base.h :
****************************************************************
class DIGITAL_API header_format_base
: public boost::enable_shared_from_this<gr::digital::header_format_base>
{
public:
typedef boost::shared_ptr<header_format_base> sptr;

header_format_base();
virtual ~header_format_base();

sptr base() { return shared_from_this(); };
sptr formatter() { return shared_from_this(); };
...

****************************************************************
head of header_format_cc1101.h:
****************************************************************
#include <f4gsw/api.h>
#include <gnuradio/digital/header_format_base.h>

namespace gr {
namespace f4gsw {

/*!
* \brief <+description+>
*
*/
class F4GSW_API header_format_cc1101
: public digital::header_format_base
{
public:

header_format_cc1101(const std::string &access_code, int
threshold,int bps);
~header_format_cc1101();
...

****************************************************************
head of header_format_cc1101.cc:
****************************************************************
#ifdef HAVE_CONFIG_H
#include "config.h"

No comments:

Post a Comment