discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] help with OOT module header_format_base child


From: Alban Meffre
Subject: [Discuss-gnuradio] help with OOT module header_format_base child
Date: Sun, 20 Jan 2019 22:09:01 +0100

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"
#endif

#include <gnuradio/io_signature.h>
#include <f4gsw/header_format_cc1101.h>
#include <volk/volk.h>
#include <gnuradio/digital/header_buffer.h>

#include <iostream>
#include <string.h>
#include <gnuradio/math.h>


namespace gr {
  namespace f4gsw {

    header_format_cc1101::header_format_cc1101(const std::string
&access_code, int threshold, int bps)
      : header_format_base(),
        d_bps(bps), d_data_reg(0), d_mask(0), d_threshold(0),
        d_pkt_len(0), d_pkt_count(0), d_nbits(0)
    {
      if(!set_access_code(access_code)) {
        throw std::runtime_error("header_format_cc1101: Setting access
code failed");
      }
      set_threshold(threshold);
    }

    header_format_cc1101::~header_format_cc1101()
    {
    }
...

anyone has an idea ?
thanks
bob



reply via email to

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