Creation of a block (PSDU 29 octets) using message passing technique

Hi,

I’m trying to use “message passing” technique in order to create a block
that generates 29 Octets. Currently, I’m using a block that generates 29
Octets and then use tag streaming. In the .cc file, IO signature looks
like:

gr_sync_block (“st1_pktsrc_dummy_b”,
gr_make_io_signature (0, 0, 0),
gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (unsigned
char)))

While, the stream tags looks like this:

add_item_tag(0, tag_pos,
d_burst_start_key,
pmt_sob,
d_my_unique_id)

Now, I want to change this approach to message passing as it is
explained
here:
https://github.com/guruofquality/grextras/wiki/Blocks-Coding-Guide.
So, I changed the lines indicated above, for the following:

: gr_sync_block (“test_temporal”,
gr_make_io_signature(0, 0, 0),
gr_make_io_signature(0, 0, 0),
msg_signature(false, 1))

and I am passing the message as follows:

this->post_msg(0, tag_pos,
d_burst_start_key,
pmt_sob,
d_my_unique_id);

However, when I compile my code after these changes, it complains about
the
class ‘asrp_test_temporal’ does not have any field named block (see the
errors attached below).

asrp_test_temporal.cc:113:5: error: class ‘asrp_test_temporal’ does not
have any field named ‘block’
asrp_test_temporal.cc:120:42: error: ‘msg_signature’ was not declared in
this scope
asrp_test_temporal.cc:120:42: note: suggested alternative:
/usr/local/include/gnuradio/block.h:58:22: note:
‘gnuradio::msg_signature’

So, I would like to ask you:

  1. Do I need to use the IO signature for message passing?, because in
    the
    example provide in the
    https://github.com/guruofquality/grextras/wiki/Blocks-Coding-Guide only
    uses msg_signature, but not gr_make_io_signature (0, 0, 0).

I would really appreciate your help, sorry for the punctuation or
grammar
mistake, English is my second language. Please let me know if you need
more
information, I will be happy to provide it.

Regards,

Jose

On 09/19/2012 01:11 AM, Jose T. Diaz wrote:

While, the stream tags looks like this:
: gr_sync_block (“test_temporal”,
gr_make_io_signature(0, 0, 0),
gr_make_io_signature(0, 0, 0),
msg_signature(false, 1))

Careful here, check the coding guide,
you need to #include <gnuradio/block.h>
and inherit from gnuradio::block

-josh

Hi Josh,

I modified in my .h file:

#include <gnuradio/block.h>

and also, I inherit from gnu radio as follows:

//* This uses the preferred technique: subclassing gr_sync_block.
//class asrp_test_temporal : public gr_sync_block
class asrp_test_temporal : public gnuradio::block // <–Here, I added
the inherit
{
private:
// Definition

Then, in the .cc file I wrote:

: gnuradio::block (“test_temporal”,
gr_make_io_signature(0, 0, 0),
gr_make_io_signature(0, 0, 0),
msg_signature(false, 1))

When I compile again, the complain is different. It displays:

asrp_test_temporal.cc:75:26: error: cannot allocate an object of
abstract
type ‘asrp_test_temporal’
./asrp_test_temporal.h:99:7: note: because the following virtual
functions are pure within ‘asrp_test_temporal’:
/usr/local/include/gnuradio/block.h:236:17: note: virtual int
gnuradio::block::work(const InputItems&, const OutputItems&)
make[2]: *** [asrp_test_temporal.lo] Error 1

According to the instruction in block coding:
https://github.com/guruofquality/grextras/wiki/Blocks-Coding-Guide, I
only
need to write the msg_signature(#input,#output), but I decided to use
the
gr_make_io_signature anyway, because I am reading the code for the
example
of “socket_to_blob.cc”.

  1. Do I need to use gr_make_io_signature or just msg_signature is
    enough?.

Many thanks for your kind help,

Regards,

Jose.

On 09/19/2012 07:42 PM, Jose T. Diaz wrote:

class asrp_test_temporal : public gnuradio::block // <–Here, I added
msg_signature(false, 1))
make[2]: *** [asrp_test_temporal.lo] Error 1

Double check the error, it just wants you to create a work method with
the given definition. The signature stuff looks just fine.

-josh

Hi Josh,

I checked the code again. I am almost there, at this stage I don’t get
any
error using gnuradio::block in my .cc file (see below):

: gnuradio::block (“test_temporal”,
gr_make_io_signature (0, 0, 0), //This is a source - no inputs
gr_make_io_signature(0, 0, 0),
msg_signature(false, 1))

and I changed the work function in the following way:

int asrp_test_temporal::work (const InputItems &input_items,
const OutputItems
&output_items)

However, when I compile this block, I am getting some errors with the
swig
file, which points out that my defined class has no member named
‘detail’
and ‘set_detail’. The errors is shown below:

asrp_swig.cc: In function ‘PyObject*
_wrap_asrp_test_temporal_sptr_detail(PyObject*, PyObject*)’:
asrp_swig.cc:8800:25: error: ‘class asrp_test_temporal’ has no member
named
‘detail’
asrp_swig.cc: In function ‘PyObject*
_wrap_asrp_test_temporal_sptr_set_detail(PyObject*, PyObject*,
PyObject*)’:
asrp_swig.cc:8852:16: error: ‘class asrp_test_temporal’ has no member
named
‘set_detail’

Do you have any suggestion in this case?.

Best Regards,

Jose.

Hi Josh,

In order to add more information, I checked the the file asrp_swig.cc,
which generates the error (line 8800) and I have the following:

SWIGINTERN PyObject *_wrap_asrp_test_temporal_sptr_detail(PyObject
*SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
boost::shared_ptr< asrp_test_temporal > *arg1 = (boost::shared_ptr<
asrp_test_temporal > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
gr_block_detail_sptr result;

if(!PyArg_UnpackTuple(args,(char
*)“asrp_test_temporal_sptr_detail”,1,1,&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0,
&argp1,SWIGTYPE_p_boost__shared_ptrT_asrp_test_temporal_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), “in method '”
“asrp_test_temporal_sptr_detail” “’, argument " “1"” of type '”
“boost::shared_ptr< asrp_test_temporal > const *”"’");
}
arg1 = reinterpret_cast< boost::shared_ptr< asrp_test_temporal > *

(argp1);
{
try {
result = (*arg1)->detail();
}
catch(std::exception &e) {
SWIG_exception(SWIG_RuntimeError, e.what());
}
catch(…) {
SWIG_exception(SWIG_RuntimeError, “Unknown exception”);
}

This files has the line “wrap_asrp_test_temporal_sptr_detail”. Also,
inside
the file block.h there is not “detail” parameter. I was using before in
my
block “gr_sync_block” and I did not get any error, I think because the
file
“gr_sync_block.h” does have a “detail” parameter. Is this right?, is
this
error due to this “detail” parameter missing?, how can I overcome/solve
this issue?.

Many thanks for your help,

Jose

On Thu, Sep 20, 2012 at 4:58 PM, Jose T. Diaz
<[email protected]

On 09/20/2012 03:28 AM, Jose T. Diaz wrote:

and I changed the work function in the following way:
asrp_swig.cc:8800:25: error: ‘class asrp_test_temporal’ has no member named
‘detail’
asrp_swig.cc: In function ‘PyObject*
_wrap_asrp_test_temporal_sptr_set_detail(PyObject*, PyObject*, PyObject*)’:
asrp_swig.cc:8852:16: error: ‘class asrp_test_temporal’ has no member named
‘set_detail’

Looks like swig is trying to understand the boost shared pointer stuff.
I usually never see this so you might be missing an include in the .i
file.

Make sure you have %include<gnuradio.i> and %include<extras_swig.i>

-josh

Hi Josh,

I’ve been playing around with this block and indeed it was missing in
the
.i file <extras_swig.i>. I included as:

%include “extras_swig.i” //add on 21 Sept
%include “extras_blobs.i” //add on 21 Sept <-- I added this line
also

Also, I tried to change other parameters, but the problem still there.
The
error is:

asrp_swig.cc: In function ‘PyObject*
_wrap_asrp_test_temporal_sptr_detail(PyObject*, PyObject*)’:
asrp_swig.cc:8800:25: error: ‘class asrp_test_temporal’ has no member
named
‘detail’
asrp_swig.cc: In function ‘PyObject*
_wrap_asrp_test_temporal_sptr_set_detail(PyObject*, PyObject*,
PyObject*)’:
asrp_swig.cc:8852:16: error: ‘class asrp_test_temporal’ has no member
named
‘set_detail’

I thought that I could remove the lines 8800 and 8852 in asrp_swig.cc
for
the variables that is complaining about (detail and set_detail).
However,
it does not compile anymore if I tried this option.

Thanks for your help,

Regards,

Jose.

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