Re: [Discuss-gnuradio] Message passing: boost::bind() not executing

2019-08-20 Thread Laura Arjona
Thank you very much Marcus.

I was using the the scheduler ( *sudo  GR_SCHEDULER=STS nice -n -10 python
./test.py* ) to start my flow graph,
I did'nt realize before that the message passing needs more than one thread.

Best

On Tue, Aug 20, 2019 at 4:53 AM Müller, Marcus (CEL) 
wrote:

> Hi!
>
> So, Occam's Razor first: Is it certain that gate_impl's general_work is
> really called regularly?
> Because: the message passing code here looks really good, and thus my
> first guess is that of the code which you sensibly omitted here, the
> rest of the general_work() somehow leads to the thing not being called.
> Or maybe it's the forecast() method?
>
> Best regards,
> Marcus
>
> On Mon, 2019-08-19 at 15:52 -0700, Laura Arjona wrote:
> >
> > Hi all,
> > I would really appreciate some help with using message passing.
> > I have 2 different OOT modules, connected (called gate and decoder). And
> I want to pass information from gate to decoder For example, the string
> "OK".
> > However, the message is not received in the decoder block. And I am not
> sure whether the problem is in my gate or in my decoder block.
> >
> > Find below a sketch of my flow graph (partial) and the code in C++
> (partial) and python
> >
> >
> >
> >
> > python main file
> > 
> > self.connect((self.gate), (self.decoder))
> > self.msg_connect(self.gate, "out_gate", self.decoder, "in_decoder")
> >
> >
> > OOT Module: gate_impl
> > /* The private constructor */
> > gate_impl::gate_impl(int sample_rate)  :
> >  gr::block("gate", gr::io_signature::make(1, 1, sizeof(gr_complex)),
> >   gr::io_signature::make(1, 1, sizeof(gr_complex) ))  {
> >
> >message_port_register_out(pmt::mp("out_gate"));
> >
> > }
> >
> > int
> > gate_impl::general_work (int noutput_items,
> >gr_vector_int _items,
> >gr_vector_const_void_star _items,
> >gr_vector_void_star _items)
> > {
> >
> > message_port_pub(pmt::mp("out_gate"), pmt::mp("OK"));
> > }
> >
> > OOT Module: decoder_impl
> >
> >  /*
> >  * The private constructor
> >  */
> > decoder_impl::decoder_impl(int sample_rate,std::vector
> output_sizes)
> >   : gr::block("decoder",
> >   gr::io_signature::make(1, 1, sizeof(gr_complex)),
> >   gr::io_signature::makev(2, 2, output_sizes)),
> >   s_rate(sample_rate)
> > {
> >
> >message_port_register_in(pmt::mp("in_decoder"));
> >
> > set_msg_handler(pmt::mp("in_decoder"),
> >boost::bind(_impl::msg_handler_method, this, _1)
> > );
> >
> > void
> > decoder_impl::msg_handler_method(pmt::pmt_t msg)
> > {
> >   std::cout << "* MESSAGE DEBUG PRINT \n";
> >   pmt::print(msg);
> >   std::cout << "**\n";
> > }
> >
> >
> >
> > ___
> > Discuss-gnuradio mailing list
> > Discuss-gnuradio@gnu.org
> > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>


-- 
*Laura Arjona *
Washington Research Foundation Innovation Postdoctoral Fellow in
Neuroengineering

*Paul G. Allen School of Computer Science & Engineering*
185 E Stevens Way NE
University of Washington
Seattle, WA 98195-2350
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message passing: boost::bind() not executing

2019-08-20 Thread CEL
Hi!

So, Occam's Razor first: Is it certain that gate_impl's general_work is
really called regularly?
Because: the message passing code here looks really good, and thus my
first guess is that of the code which you sensibly omitted here, the
rest of the general_work() somehow leads to the thing not being called.
Or maybe it's the forecast() method?

Best regards,
Marcus

On Mon, 2019-08-19 at 15:52 -0700, Laura Arjona wrote:
> 
> Hi all,
> I would really appreciate some help with using message passing.
> I have 2 different OOT modules, connected (called gate and decoder). And I 
> want to pass information from gate to decoder For example, the string "OK".
> However, the message is not received in the decoder block. And I am not sure 
> whether the problem is in my gate or in my decoder block.
> 
> Find below a sketch of my flow graph (partial) and the code in C++ (partial) 
> and python
> 
> 
> 
> 
> python main file
> 
> self.connect((self.gate), (self.decoder))
> self.msg_connect(self.gate, "out_gate", self.decoder, "in_decoder")
> 
> 
> OOT Module: gate_impl
> /* The private constructor */
> gate_impl::gate_impl(int sample_rate)  : 
>  gr::block("gate", gr::io_signature::make(1, 1, sizeof(gr_complex)),
>   gr::io_signature::make(1, 1, sizeof(gr_complex) ))  { 
> 
>message_port_register_out(pmt::mp("out_gate"));
> 
> }
> 
> int
> gate_impl::general_work (int noutput_items,
>gr_vector_int _items,
>gr_vector_const_void_star _items,
>gr_vector_void_star _items)
> {
> 
> message_port_pub(pmt::mp("out_gate"), pmt::mp("OK"));
> }
> 
> OOT Module: decoder_impl 
> 
>  /*
>  * The private constructor
>  */
> decoder_impl::decoder_impl(int sample_rate,std::vector output_sizes)
>   : gr::block("decoder",
>   gr::io_signature::make(1, 1, sizeof(gr_complex)),
>   gr::io_signature::makev(2, 2, output_sizes)),
>   s_rate(sample_rate)
> {
> 
>message_port_register_in(pmt::mp("in_decoder"));
> 
> set_msg_handler(pmt::mp("in_decoder"), 
>boost::bind(_impl::msg_handler_method, this, _1)  
> );
> 
> void
> decoder_impl::msg_handler_method(pmt::pmt_t msg)
> {
>   std::cout << "* MESSAGE DEBUG PRINT \n";
>   pmt::print(msg);
>   std::cout << "**\n";
> }
> 
> 
> 
> ___
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


smime.p7s
Description: S/MIME cryptographic signature
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message passing to UHD: USRP source/sink

2019-04-05 Thread Aravind Deshikh
In the above-explained case scenario, I'm thinking of appending the csv to
a dictionary and based on a loop, can I code (IN PYTHON) the work function
of the block according to when there is 1, the corresponding channel
frequency is sent as a message when it reads a change:
So, firstly, Is it possible to use "import csv" in the block code? IF YES,
the work function goes something like:

PSEUDO-CODE:
1) iterate through the .csv file saved in a dictionary and compare it with
the expected forms of row (0001 or 0010 or 0100 or 1000).
2) Using 4 counters, one for each form; when there is a change in the row
format, all counters are set to zero and that particular counter sets to 1.
3) As soon as the counter is 1 it should send its corresponding
"tune_request message". NOW, HOW SHOULD I DO THIS?
4) And after each iteration over 1 row the code sleeps for 1 second and
moves to the next row using sleep(1).

If NO, how do I create access to the .csv file to this block?

If there is any other way I need to look at this please let me know!

Aravind Deshikh. V

On Thu, Apr 4, 2019 at 11:32 PM Aravind Deshikh 
wrote:

> Hello everyone,
> I'm working on frequency hopping using GNU Radio and USRP N210 as a
> function of Cognitive radio. Here, I have a .csv file which has the
> availability of channel to use among 4 frequency channels in a
> binary format like:
> CH0CH1 CH2 CH3
> (900)   (910)(920)   (930)   (Mhz)
> 1 0  0   0   (for 10 rows)
> 0 1  0   0   (for the next 10 rows)
> 0 0  1   0   (for the next 10 rows)
>
> 0 0  0   1   (for the next 10 rows)
>
> and each row is the spectrum occupancy for 1 second interval.
> I have to create a GNU Radio custom block to send timed PMT messages to
> the command input of USRP source to HOP THE FREQUENCY.
> I'm unable to understand how to use the "Message Passing API" to
> create this block using "GR-MODTOOL" that needs to send a "tune_request" as
> a message to change the "freq" at the UHD: USRP SOURCE. Please let me know
> if I'm missing something here that will help me do this or what I need to
> do, to code such a bloc function.
>
> I have read through the message passing API (msg_handler function) and the
> formats for the tune request, but it is hard to figure this out.
> SOMEBODY, PLEASE HELP ME TO DO THIS.
> Any kind of help with this would be of great value to me and is
> wholeheartedly appreciated.
>
> Thank you very much in advance.
>
> Sincerely,
> Aravind Deshikh. V
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message Passing Not Working

2017-07-24 Thread Bastian Bloessl

Hi,

AFAIS, you call the output message port "gain", but try to publish to 
the message port "gain_port". When I changed it to use "gain", it seems 
to work.


Best,
Bastian


On 07/22/2017 12:49 AM, Tellrell White wrote:
In the attached flow graph, I've created a block, "gain setter" that 
takes in a number of input items and after the input items reach a 
certain amount, the block will issue a command to the ursp sink to 
change the gain to a certain value. I basically did this using a loop. 
However, it doesn't seem like the gain of the signal changes according 
to the freq sink plot of the received signal. Any ideas??




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


Re: [Discuss-gnuradio] Message passing.

2015-11-06 Thread Tom Rondeau
On Wed, Nov 4, 2015 at 3:06 PM, M. Ranganathan  wrote:

> Hello!
>
> I am building a monitor where capture of I/Q samples to a file is
> triggered on an pluggable detection scheme. For example, I want to capture
> say 10 seconds of I/Q samples when LTE is detected.
>
> Is this an appropriate place to use
> https://gnuradio.org/doc/doxygen/page_msg_passing.html ?
>
>
> Thanks
>
> --
> M. Ranganathan
>


Closely related is the eventstream model from Tim O'Shea:

https://github.com/osh/gr-eventstream

That's probably more appropriate to what you're looking to do.

Tom
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message passing(connect) in C++

2015-04-30 Thread Mostafa Alizadeh
excuse me,

I'm seeing the new API 3.7.7 of GNURadio which is changed. The connect is
a member of gr::flowgraph which connects both blocks' ports and message
ports:

http://gnuradio.org/doc/doxygen/classgr_1_1flowgraph.html#af8678658129a819673a59555d030aaac

Best,

On Thu, Apr 30, 2015 at 4:15 PM, Mostafa Alizadeh m.alizade...@gmail.com
wrote:

 Hi Marco,

 The top_block class has a member named: connect. You can use it in the
 main() to connect different blocks. However, if you want to dis/connect
 blocks within C++ blocks, you must pass top_block pointer to the class in
 some fashion. Once I did and I got errors because I didn't have accessed to
 the connect from within the block.

 I prefer to change your topology to refuse the need you've mentioned.
 Otherwise describe your problem with more details.


 Best,
 Mostafa



 On Thu, Apr 30, 2015 at 3:43 PM, marco Ribero spam.marco.s...@gmail.com
 wrote:

 Hi all,
 I have another question. How can I connect the input and output port of
 different blocks,from inside a C++ block? In the documentation I've only
 seen the msg_connect() for python

 Thanks,
 marco

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




 --
 ***
 Department of Electrical Engineering
 Aboureyhan Building
 MMWCL LAB
 Amirkabir University Of Technology
 Tehran
 IRAN
 Tel: +98 (919) 158-7730
 LAB: http://ele.aut.ac.ir/~mmwcl/?page_id=411
 Homepage: http://ele.aut.ac.ir/~alizadeh/
 ***




-- 
***
Department of Electrical Engineering
Aboureyhan Building
MMWCL LAB
Amirkabir University Of Technology
Tehran
IRAN
Tel: +98 (919) 158-7730
LAB: http://ele.aut.ac.ir/~mmwcl/?page_id=411
Homepage: http://ele.aut.ac.ir/~alizadeh/
***
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message passing(connect) in C++

2015-04-30 Thread marco Ribero
I want to exchange data between adjacent blocks which are already connected
through the GUI, without ask to the user to write  additional code.
So my approach would be: the upper block send down its name(through tags)
and the lower block configure the communication, so I thought to take
advantage from message passing.
If I won't be able to use this approach, I will use some memory shared
mechanism.

Just a question,in order to use the gr::flowgraph:connect(),I need to get
the object flowgraph from the XML file situated in GRC,isn't it?

Il giorno gio 30 apr 2015 alle ore 13:48 Mostafa Alizadeh 
m.alizade...@gmail.com ha scritto:

 excuse me,

 I'm seeing the new API 3.7.7 of GNURadio which is changed. The connect
 is a member of gr::flowgraph which connects both blocks' ports and message
 ports:


 http://gnuradio.org/doc/doxygen/classgr_1_1flowgraph.html#af8678658129a819673a59555d030aaac

 Best,

 On Thu, Apr 30, 2015 at 4:15 PM, Mostafa Alizadeh m.alizade...@gmail.com
 wrote:

 Hi Marco,

 The top_block class has a member named: connect. You can use it in the
 main() to connect different blocks. However, if you want to dis/connect
 blocks within C++ blocks, you must pass top_block pointer to the class in
 some fashion. Once I did and I got errors because I didn't have accessed to
 the connect from within the block.

 I prefer to change your topology to refuse the need you've mentioned.
 Otherwise describe your problem with more details.


 Best,
 Mostafa



 On Thu, Apr 30, 2015 at 3:43 PM, marco Ribero spam.marco.s...@gmail.com
 wrote:

 Hi all,
 I have another question. How can I connect the input and output port of
 different blocks,from inside a C++ block? In the documentation I've only
 seen the msg_connect() for python

 Thanks,
 marco

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




 --
 ***
 Department of Electrical Engineering
 Aboureyhan Building
 MMWCL LAB
 Amirkabir University Of Technology
 Tehran
 IRAN
 Tel: +98 (919) 158-7730
 LAB: http://ele.aut.ac.ir/~mmwcl/?page_id=411
 Homepage: http://ele.aut.ac.ir/~alizadeh/
 ***




 --
 ***
 Department of Electrical Engineering
 Aboureyhan Building
 MMWCL LAB
 Amirkabir University Of Technology
 Tehran
 IRAN
 Tel: +98 (919) 158-7730
 LAB: http://ele.aut.ac.ir/~mmwcl/?page_id=411
 Homepage: http://ele.aut.ac.ir/~alizadeh/
 ***

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


Re: [Discuss-gnuradio] Message passing(connect) in C++

2015-04-30 Thread Mostafa Alizadeh
Hi Marco,

The top_block class has a member named: connect. You can use it in the
main() to connect different blocks. However, if you want to dis/connect
blocks within C++ blocks, you must pass top_block pointer to the class in
some fashion. Once I did and I got errors because I didn't have accessed to
the connect from within the block.

I prefer to change your topology to refuse the need you've mentioned.
Otherwise describe your problem with more details.


Best,
Mostafa



On Thu, Apr 30, 2015 at 3:43 PM, marco Ribero spam.marco.s...@gmail.com
wrote:

 Hi all,
 I have another question. How can I connect the input and output port of
 different blocks,from inside a C++ block? In the documentation I've only
 seen the msg_connect() for python

 Thanks,
 marco

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




-- 
***
Department of Electrical Engineering
Aboureyhan Building
MMWCL LAB
Amirkabir University Of Technology
Tehran
IRAN
Tel: +98 (919) 158-7730
LAB: http://ele.aut.ac.ir/~mmwcl/?page_id=411
Homepage: http://ele.aut.ac.ir/~alizadeh/
***
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message passing(connect) in C++

2015-04-30 Thread Marcus Müller
Hi Marco,

ok, I think it's best if I describe a bit of what happens behind the
curtains:
GRC is really just a graphical generator for python code. As soon as you
hit the generate button (or the run button, where generating is done
inherently), python code is written that has no connection, knowledge or
dependency to the XML that was used to generate it.

From a user-friendliness point of view, I can fully understand your
approach to take the burden to explicitly connect up- and downstream
blocks off your user's shoulders. You can actually hack together
something like that even without the use of tags, by just implementing a
start() method in your block. You'd pass a top_block::sptr to the
constructor, and then, in your_block::start() get the upstream block
doing  your_block::detail()-input(0)-buffer()-link(), check that
block for being your other block type, and if not, continue the search
through the flow graph in the same matter. After you've found your other
block, ou use your stored top_block::sptr to -msg_connect(other_block,
this_block).

However: that breaks a lot of assumptions I would made when looking at a
flow graph, mainly the assumption that downstream blocks don't invisibly
influence behaviour of upstream blocks. Honestly, letting your user
connect your two blocks with msg_connect doesn't sound like a bad idea
in the long run.

Or you come up with a hier-block-based approach: -- are sample streams,
## message passing


.--.
|   your_hier_block|
|--|
|  |
|   .. |
|   |  your_upstream_block   | |
|   || |
|   ---||to user 
blocks
|   |   || |
|   |   '' |
---|--- ^ |
|# |
|# |
|   .. |
|   | your_downstream_block  | |
|   || |
|   ||from user 
blocks
|   || |
|   '' |
|| |
'|-'
 --to further 
processing



Best regards,
Marcus

On 04/30/2015 02:51 PM, marco Ribero wrote:
 I want to exchange data between adjacent blocks which are already
 connected through the GUI, without ask to the user to write
  additional code.
 So my approach would be: the upper block send down its name(through
 tags) and the lower block configure the communication, so I thought to
 take advantage from message passing.
 If I won't be able to use this approach, I will use some memory shared
 mechanism.

 Just a question,in order to use the gr::flowgraph:connect(),I need to
 get the object flowgraph from the XML file situated in GRC,isn't it?

 Il giorno gio 30 apr 2015 alle ore 13:48 Mostafa Alizadeh
 m.alizade...@gmail.com mailto:m.alizade...@gmail.com ha scritto:

 excuse me,

 I'm seeing the new API 3.7.7 of GNURadio which is changed. The
 connect is a member of gr::flowgraph which connects both blocks'
 ports and message ports:

 
 http://gnuradio.org/doc/doxygen/classgr_1_1flowgraph.html#af8678658129a819673a59555d030aaac

 Best,

 On Thu, Apr 30, 2015 at 4:15 PM, Mostafa Alizadeh
 m.alizade...@gmail.com mailto:m.alizade...@gmail.com wrote:

 Hi Marco, 

 The top_block class has a member named: connect. You can use
 it in the main() to connect different blocks. However, if you
 want to dis/connect blocks within C++ blocks, you must pass
 top_block pointer to the class in some fashion. Once I did and
 I got errors because I didn't have accessed to the connect
 from within the block. 

 I prefer to change your topology to refuse the need you've
 mentioned. Otherwise describe your problem with more details.


 Best,
 Mostafa



 On Thu, Apr 30, 2015 at 3:43 PM, marco Ribero
 spam.marco.s...@gmail.com mailto:spam.marco.s...@gmail.com
 wrote:

 Hi all,
 I have another question. How can I connect the input and
 output port of different blocks,from inside a C++ block?
   

Re: [Discuss-gnuradio] Message passing(connect) in C++

2015-04-30 Thread marco Ribero
Marcus, thank you very much for your deep answer.
Your proposal about the usage of
your_block::detail()-input(0)-buffer()-link seem very interesting, so I
shoulld evaluate if use this mechanism or only some memory allocation
created with malloc.

I'd prefer to simplify the life of user as much as possible..I'll put my
blocks on a repository, hoping that some user will use these blocks.

Your proposal of a hierarcly approach is interesting,but in my case could
be more problematic: user can have a DAG or graph flowgraph,and the reserch
of the next block,performed by each involved block,could add some
complexity, considering that I need to open connection only between
adjacent blocks.

I summarize what I'm doing: as thesis ,I'm trying to make a partial porting
over CUDA..so I'm re-implementing blocks with CUDA. Each block allocate a
circular buffer of device pages,passing these pointer with other info to
the next block(using a tag with a pointer to host memory). Now I want to
establish an initial handshake, because the following block could have
preferences(usually not mandatory,because often the first step of a block
is to copy data from global to shared memory,allowing some degree of
freedom) about incoming data(e.g. min-max dimension of each
page,min_multiple for input data of FFT,..). Each block receive data
throught device memory,elaborate all data and return a single useless
tap,in order to wake up other blocks..at the end of chain,data will be
copied into host memory.

Marco
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message passing - issue with messages left in queues after running top block

2014-07-23 Thread Tom Rondeau
On Tue, Jul 22, 2014 at 8:44 AM, Perper per...@o2.pl wrote:

 Hi all,

 I've noticed that Run to completion works now in situation when
 message passing is used, which is great!
 I have a related question. I'm creating a block which uses message
 passing, and run it once:

 tb = some_block(fname=file1)
 tb.start()
 tb.wait()

 #at this moment tb has still some unprocessed messages in message queues
 #so if I run the block again on another file ...

 tb.set_fname(file2)
 tb.start()
 tb.wait()


 I can see messages that were result of processing of file1. Do you know
 how to avoid this?
 One of acceptable solutions can be flushing msg queues after processing
 of file1, but I don't know how to achieve this.

 Best Regards,
 Piotr Krysik


There are still a couple of issues with the message passing, obviously. The
proper shutdown of graphs is definitely on our list of things to deal with.
We hope to have improvements that cover issues like this by the release of
3.7.5.

Tom
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message Passing

2014-05-15 Thread Activecat
On Wed, May 14, 2014 at 10:25 PM, Tom Rondeau t...@trondeau.com wrote:

 On Wed, May 14, 2014 at 7:06 AM, Activecat active...@gmail.com wrote:

 On Wed, May 14, 2014 at 6:49 PM, Koslowski, Sebastian (CEL) 
 sebastian.koslow...@kit.edu wrote:

 I retried by putting the definition of sink/sink on top of
 source/source in the xml file, it works.
 It seems that the sink definition must be placed on top of source ..

 Problem solved, thank everyone !


 Yes, this is the strictness of the XML DTD. Glad you got it working.
  Tom


Thank you very much.
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message Passing

2014-05-14 Thread Martin Braun

On 14.05.2014 08:11, Activecat wrote:

Dear gurus,

I am learning gnuradio Message Passing feature, but couldn't get
desirable result.
The Message seems published successfully, but not subscribed by the
Message receiver.
How to correct the error ..?


Just to make sure: You did connect the ports in your flow graph?

That said, I've seen something like this recently. Maybe there's a 
bug... needs investigating.


M


The message sender block:

 // constructor
 message_source1_impl::message_source1_impl()
   : gr::sync_block(message_source1,
   gr::io_signature::make(0, 0, 0),
   gr::io_signature::make( 1, 1, sizeof(int)) )
 {
 message_port_register_out( pmt::mp(print) );
 }

 // send_message1
 void
 message_source1_impl::send_message1()
 {
 std::cout  message_source1_impl::send_message():
invoked  std::endl;
 pmt::pmt_t str0 = pmt::string_to_symbol(
std::string(Welcome 2014));
 message_port_pub( pmt::mp(print), str0 );
 }

 // work
 int
 message_source1_impl::work(int noutput_items,
   gr_vector_const_void_star input_items,
   gr_vector_void_star output_items)
 {
 int *out = (int *) output_items[0];
 for (int i=0; i  noutput_items; i++)
 out[i] = (i+1) * (i+1);

 send_message1();
 return noutput_items;
 }



The message receiver block:

 // constructor
 message_sink1_impl::message_sink1_impl()
   : gr::sync_block(message_sink1,
   gr::io_signature::make(0, 0, 0),
   gr::io_signature::make( 1, 1, sizeof(int)) )
 {
 message_port_register_in( pmt::mp(print) );
 set_msg_handler( pmt::mp(print), boost::bind(
message_sink1_impl::handler1, this, _1 ) );
 }

 // message handler
 void
 message_sink1_impl::handler1( pmt::pmt_t myMessage )
 {
 std::cout  message_sink1_impl::handler1():  invoked 
std::endl;
 pmt::print( myMessage );
 }

 // work
 int
 message_sink1_impl::work(int noutput_items,
   gr_vector_const_void_star input_items,
   gr_vector_void_star output_items)
 {
 int *out = (int *) output_items[0];
 for (int i=0; i  noutput_items; i++)
 out[i] = i+1;

 return noutput_items;
 }



Flow graph execution output:
 Executing: /home/mmkk/gnuradio/gr-activecat/apps/top_block.py
 message_source1_impl::send_message():  invoked
 message_source1_impl::send_message():  invoked
 message_source1_impl::send_message():  invoked
 message_source1_impl::send_message():  invoked
 message_source1_impl::send_message():  invoked


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




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


Re: [Discuss-gnuradio] Message Passing

2014-05-14 Thread Activecat
On Wed, May 14, 2014 at 4:26 PM, Martin Braun martin.br...@ettus.comwrote:

 On 14.05.2014 08:11, Activecat wrote:

 Dear gurus,

 I am learning gnuradio Message Passing feature, but couldn't get
 desirable result.
 The Message seems published successfully, but not subscribed by the
 Message receiver.
 How to correct the error ..?


 Just to make sure: You did connect the ports in your flow graph?
 That said, I've seen something like this recently. Maybe there's a bug...
 needs investigating.
 M


Both blocks (message sender block, message receiver block) are source
blocks, both are directly connected to the inputs of a divider blocks,
i.e. the message receiver block is not at the downstream of the message
sender block.  I guess this is ok because Message Passing is for downstream
blocks to communicate to upstream blocks. Is this correct?

This is part of the top_block.py generated by GRC, to illustrate the
flowgraph.

##
# Blocks
##
self.blocks_head_0 = blocks.head(gr.sizeof_int*1, 10)
self.blocks_divide_xx_0 = blocks.divide_ii(1)
self.activecat_message_source1_0 = activecat.message_source1()
self.activecat_message_sink1_0 = activecat.message_sink1()
self.activecat_integer_sink3_0 = activecat.integer_sink3(False,
True, Integer1)

##
# Connections
##
self.connect((self.blocks_divide_xx_0, 0), (self.blocks_head_0, 0))
self.connect((self.blocks_head_0, 0),
(self.activecat_integer_sink3_0, 0))
self.connect((self.activecat_message_source1_0, 0),
(self.blocks_divide_xx_0, 0))
self.connect((self.activecat_message_sink1_0, 0),
(self.blocks_divide_xx_0, 1))

System info:
Gnuradio version = 3.7.3
OS =  Debian jessie/sid, SMP Debian 3.13.10-1 x86_64 GNU/Linux
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message Passing

2014-05-14 Thread Martin Braun

On 14.05.2014 11:14, Activecat wrote:

Both blocks (message sender block, message receiver block) are source
blocks, both are directly connected to the inputs of a divider blocks,
i.e. the message receiver block is not at the downstream of the message
sender block.  I guess this is ok because Message Passing is for
downstream blocks to communicate to upstream blocks. Is this correct?


The message passing API doesn't really care about who's upstream for the 
streaming API.



This is part of the top_block.py generated by GRC, to illustrate the
flowgraph.

 ##
 # Blocks
 ##
 self.blocks_head_0 = blocks.head(gr.sizeof_int*1, 10)
 self.blocks_divide_xx_0 = blocks.divide_ii(1)
 self.activecat_message_source1_0 = activecat.message_source1()
 self.activecat_message_sink1_0 = activecat.message_sink1()
 self.activecat_integer_sink3_0 = activecat.integer_sink3(False,
True, Integer1)

 ##
 # Connections
 ##
 self.connect((self.blocks_divide_xx_0, 0), (self.blocks_head_0, 0))
 self.connect((self.blocks_head_0, 0),
(self.activecat_integer_sink3_0, 0))
 self.connect((self.activecat_message_source1_0, 0),
(self.blocks_divide_xx_0, 0))
 self.connect((self.activecat_message_sink1_0, 0),
(self.blocks_divide_xx_0, 1))


There's no msg_connect() call here -- that would be your problem.

M


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


Re: [Discuss-gnuradio] Message Passing

2014-05-14 Thread Activecat
On Wed, May 14, 2014 at 5:26 PM, Martin Braun martin.br...@ettus.comwrote:

 There's no msg_connect() call here -- that would be your problem.
 M


I build the flowgraph using GRC. How to make correction?
The complete top_block.py is as follows.

#!/usr/bin/env python
##
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Wed May 14 17:30:37 2014
##

from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import activecat
import wx

class top_block(grc_wxgui.top_block_gui):

def __init__(self):
grc_wxgui.top_block_gui.__init__(self, title=Top Block)
_icon_path = /usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png
self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

##
# Variables
##
self.samp_rate = samp_rate = 32000

##
# Blocks
##
self.blocks_head_0 = blocks.head(gr.sizeof_int*1, 10)
self.blocks_divide_xx_0 = blocks.divide_ii(1)
self.activecat_message_source1_0 = activecat.message_source1()
self.activecat_message_sink1_0 = activecat.message_sink1()
self.activecat_integer_sink3_0 = activecat.integer_sink3(False,
True, Integer1)

##
# Connections
##
self.connect((self.blocks_divide_xx_0, 0), (self.blocks_head_0, 0))
self.connect((self.blocks_head_0, 0),
(self.activecat_integer_sink3_0, 0))
self.connect((self.activecat_message_source1_0, 0),
(self.blocks_divide_xx_0, 0))
self.connect((self.activecat_message_sink1_0, 0),
(self.blocks_divide_xx_0, 1))


# QT sink close method reimplementation

def get_samp_rate(self):
return self.samp_rate

def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate

if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startswith('linux'):
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print Warning: failed to XInitThreads()
parser = OptionParser(option_class=eng_option, usage=%prog: [options])
(options, args) = parser.parse_args()
tb = top_block()
tb.Start(True)
tb.Wait()
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message Passing

2014-05-14 Thread Sylvain Munaut
Hi,

 There's no msg_connect() call here -- that would be your problem.
 M


 I build the flowgraph using GRC. How to make correction?
 The complete top_block.py is as follows.

Did you define the message port in the .grc XML file for your blocks ?

Something like :

  sink
nameportname/name
typemessage/type
optional1/optional
  /sink

Then they should show as message port in the GRC UI and you need to
connect them in the GUI.


Cheers,

   Sylvain

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


Re: [Discuss-gnuradio] Message Passing

2014-05-14 Thread Martin Braun

On 14.05.2014 11:35, Activecat wrote:


On Wed, May 14, 2014 at 5:26 PM, Martin Braun martin.br...@ettus.com
mailto:martin.br...@ettus.com wrote:

There's no msg_connect() call here -- that would be your problem.
M


I build the flowgraph using GRC. How to make correction?


To correct this, connect the message ports.

M



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


Re: [Discuss-gnuradio] Message Passing

2014-05-14 Thread Activecat
On Wed, May 14, 2014 at 5:50 PM, Sylvain Munaut 246...@gmail.com wrote:

 Did you define the message port in the .grc XML file for your blocks ?

 Something like :

   sink
 nameportname/name
 typemessage/type
 optional1/optional
   /sink

 Then they should show as message port in the GRC UI and you need to
 connect them in the GUI.


This works: (this add additional port in gray color)
  source
nameprint/name
typemessage/type
optional1/optional
  /source


Whereas this doesn't work: (the block becomes disappeared in the GRC)
  sink
nameprint/name
typemessage/type
optional1/optional
  /sink

Then how to define the message sink port?
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message Passing

2014-05-14 Thread Activecat
On Wed, May 14, 2014 at 6:18 PM, Activecat active...@gmail.com wrote:


 On Wed, May 14, 2014 at 5:50 PM, Sylvain Munaut 246...@gmail.com wrote:

 Did you define the message port in the .grc XML file for your blocks ?
 Something like :

   sink
 nameportname/name
 typemessage/type
 optional1/optional
   /sink

 Then they should show as message port in the GRC UI and you need to
 connect them in the GUI.


 This works: (this add additional port in gray color)
   source
 nameprint/name
 typemessage/type
 optional1/optional
   /source

 Whereas this doesn't work: (the block becomes disappeared in the GRC)
   sink
 nameprint/name
 typemessage/type
 optional1/optional
   /sink

 Then how to define the message sink port?



I have then tested few combinations, it seems that a source block cannot
have a message sink port.
Is there such a restriction ..?
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message Passing

2014-05-14 Thread Koslowski, Sebastian (CEL)
On 05/14/2014 12:29 PM, Activecat wrote:
 I have then tested few combinations, it seems that a source block cannot
 have a message sink port.
 Is there such a restriction ..?

Not that I know of...

?xml version='1.0' encoding='ASCII'?
block
  nameTest/name
  keymessage_sink_complex_source_test/key
  categoryCustom/category
  makeNone/make
  sink
namein/name
typemessage/type
optionalTrue/optional
  /sink
  source
nameout/name
typecomplex/type
  /source
/block

Works here (GR version: recent master).

(This is a dummy block. The generated FG wont run)

Sebastian

-- 
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Sebastian Koslowski
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe, Germany

Phone: +49 721 608-46275
Fax:   +49 721 608-46071
Email: sebastian.koslow...@kit.edu
Web:   http://www.cel.kit.edu/

KIT – University of the State of Baden-Wuerttemberg and National
Research Center of the Helmholtz Association



signature.asc
Description: OpenPGP digital signature
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message Passing

2014-05-14 Thread Activecat
On Wed, May 14, 2014 at 6:49 PM, Koslowski, Sebastian (CEL) 
sebastian.koslow...@kit.edu wrote:

 On 05/14/2014 12:29 PM, Activecat wrote:
  I have then tested few combinations, it seems that a source block cannot
  have a message sink port.
  Is there such a restriction ..?

 Not that I know of...

 ?xml version='1.0' encoding='ASCII'?
 block
   nameTest/name
   keymessage_sink_complex_source_test/key
   categoryCustom/category
   makeNone/make
   sink
 namein/name
 typemessage/type
 optionalTrue/optional
   /sink
   source
 nameout/name
 typecomplex/type
   /source
 /block


I retried by putting the definition of sink/sink on top of
source/source in the xml file, it works.
It seems that the sink definition must be placed on top of source ..

Problem solved, thank everyone !
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Message Passing

2014-05-14 Thread Tom Rondeau
On Wed, May 14, 2014 at 7:06 AM, Activecat active...@gmail.com wrote:


 On Wed, May 14, 2014 at 6:49 PM, Koslowski, Sebastian (CEL) 
 sebastian.koslow...@kit.edu wrote:

 On 05/14/2014 12:29 PM, Activecat wrote:
  I have then tested few combinations, it seems that a source block cannot
  have a message sink port.
  Is there such a restriction ..?

 Not that I know of...

 ?xml version='1.0' encoding='ASCII'?
 block
   nameTest/name
   keymessage_sink_complex_source_test/key
   categoryCustom/category
   makeNone/make
   sink
 namein/name
 typemessage/type
 optionalTrue/optional
   /sink
   source
 nameout/name
 typecomplex/type
   /source
 /block


 I retried by putting the definition of sink/sink on top of
 source/source in the xml file, it works.
 It seems that the sink definition must be placed on top of source ..

 Problem solved, thank everyone !



Yes, this is the strictness of the XML DTD. Glad you got it working.

Tom
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] message passing test

2014-01-29 Thread Marcus Müller
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Neil,

yes, this can't work; you can only multiply two numbers if there are
two numbers (factors). Which will never be the case, since there has
not been a multiplication before the first factor.

Message passing can't make an flowgraph that has a synchronous path
(normal sample flow) asynchronous. What you most probably want is to
receive the message with a block that e.g. sets the factor in a
multiply_const block.

Hope I could help a little,
Marcus

On 29.01.2014 13:15, MHMND Herath wrote:
 Dear sir I want to implement a feedback system for example attached
 feedbackmessageoassing.pdf attached. Its output is zero. No thing
 comes for output. I tested message passing in different ways. No
 clear output comes. For the above feedback system nothing comes
 out. Please help me. How to implement such a feedback syste. Thanks
  Neil
 
 
 
 ___ Discuss-gnuradio
 mailing list Discuss-gnuradio@gnu.org 
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJS6PQyAAoJEAFxB7BbsDrLGIsH/RFTQcOvjsEjHoXPbbhRKF6o
Ijh08glAHCxF4UVUl/NVRhx/jXBUZSPeFO7KBN/xw6ub9sWu7JhC1YW52AYXtz4a
AuFohOgRTZ6XbiheCsLBLXSpZSpIH6tiNQe5fXoFOnypJ1xpihixidi9hOKiJqKM
kKzinKYl7r9lzYOciqQCxRz4LbDlwKX2hYT3NoRnq9DvjO25pxM7aE7hUyMGQPPx
xrMAjYuHVekniDvDRvD7JsjMBw1huTv+Ooof1vTmtIu4BT8ikJsXmkvs29I4GWlk
zZ8N8isS3JyqZIsgskCLUeyLb0zHzWwIwiQ5hW52hdh/rfYzmVI/hGfWF/k3VWg=
=ynZf
-END PGP SIGNATURE-

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


Re: [Discuss-gnuradio] message passing error

2014-01-25 Thread Johan Carlsson

Looks like a a C++ or boost question?

Are you experienced in using C++ templates?

Regards,
Johan

On Sat, 25 Jan 2014, MHMND Herath wrote:



Dear Sir
When I trying to implement message passing between 2 blocks called a1_ff and
a2_ff following error comes when comiling. I cannot trace it.
Thanks
Neil
-
Scanning dependencies of target gnuradio-avg
[  5%] Building CXX object lib/CMakeFiles/gnuradio-avg.dir/a1_ff_impl.cc.o
In file included from /usr/include/boost/bind.hpp:22:0,
from /usr/include/boost/thread/detail/thread.hpp:29,
from /usr/include/boost/thread/thread.hpp:22,
from /usr/local/include/gnuradio/thread/thread.h:26,
from /usr/local/include/gnuradio/basic_block.h:31,
from /usr/local/include/gnuradio/block.h:27,
from /usr/local/include/gnuradio/sync_block.h:27,
from /home/neil/gr-avg/include/avg/a1_ff.h:26,
from /home/neil/gr-avg/lib/a1_ff_impl.h:23,
from /home/neil/gr-avg/lib/a1_ff_impl.cc:26:
/usr/include/boost/bind/bind.hpp: In instantiation of ?struct
boost::_bi::result_traitsboost::_bi::unspecified, void
(gr::avg::a1_ff_impl::*)()?:
/usr/include/boost/bind/bind_template.hpp:15:48:   required from ?class
boost::_bi::bind_tboost::_bi::unspecified, void (gr::avg::a1_ff_impl::*)(),
boost::_bi::list2boost::_bi::valuegr::avg::a1_ff_impl*, boost::arg1  ?
/home/neil/gr-avg/lib/a1_ff_impl.cc:49:43:   required from here
/usr/include/boost/bind/bind.hpp:69:37: error: ?void
(gr::avg::a1_ff_impl::*)()? is not a class, struct, or union type
typedef typename F::result_type type;
^
In file included from /usr/include/boost/function/detail/maybe_include.hpp:18:0,
from /usr/include/boost/function/detail/function_iterate.hpp:14,
from
/usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
from /usr/include/boost/function.hpp:64,
from /usr/local/include/gnuradio/basic_block.h:33,
from /usr/local/include/gnuradio/block.h:27,
from /usr/local/include/gnuradio/sync_block.h:27,
from /home/neil/gr-avg/include/avg/a1_ff.h:26,
from /home/neil/gr-avg/lib/a1_ff_impl.h:23,
from /home/neil/gr-avg/lib/a1_ff_impl.cc:26:
/usr/include/boost/function/function_template.hpp: In instantiation of ?static
void boost::detail::function::void_function_obj_invoker1FunctionObj, R,
T0::invoke(boost::detail::function::function_buffer, T0) [with FunctionObj =
boost::_bi::bind_tboost::_bi::unspecified, void (gr::avg::a1_ff_impl::*)(),
boost::_bi::list2boost::_bi::valuegr::avg::a1_ff_impl*, boost::arg1  ;
R = void; T0 = boost::intrusive_ptrpmt::pmt_base]?:
/usr/include/boost/function/function_template.hpp:934:38:   required from
?void boost::function1R, T1::assign_to(Functor) [with Functor =
boost::_bi::bind_tboost::_bi::unspecified, void (gr::avg::a1_ff_impl::*)(),
boost::_bi::list2boost::_bi::valuegr::avg::a1_ff_impl*, boost::arg1  ;
R = void; T0 = boost::intrusive_ptrpmt::pmt_base]?
/usr/include/boost/function/function_template.hpp:722:7:   required from
?boost::function1R, T1::function1(Functor, typename
boost::enable_if_cboost::type_traits::ice_notboost::is_integralFunctor::value::value,
int::type) [with Functor = boost::_bi::bind_tboost::_bi::unspecified, void
(gr::avg::a1_ff_impl::*)(),
boost::_bi::list2boost::_bi::valuegr::avg::a1_ff_impl*, boost::arg1  ;
R = void; T0 = boost::intrusive_ptrpmt::pmt_base; typename
boost::enable_if_cboost::type_traits::ice_notboost::is_integralFunctor::value::value,
int::type = int]?
/usr/include/boost/function/function_template.hpp:1069:16:   required from
?boost::functionR(T0)::function(Functor, typename
boost::enable_if_cboost::type_traits::ice_notboost::is_integralFunctor::value::value,
int::type) [with Functor = boost::_bi::bind_tboost::_bi::unspecified, void
(gr::avg::a1_ff_impl::*)(),
boost::_bi::list2boost::_bi::valuegr::avg::a1_ff_impl*, boost::arg1  ;
R = void; T0 = boost::intrusive_ptrpmt::pmt_base; typename
boost::enable_if_cboost::type_traits::ice_notboost::is_integralFunctor::value::value,
int::type = int]?
/usr/local/include/gnuradio/basic_block.h:344:34:   required from ?void
gr::basic_block::set_msg_handler(pmt::pmt_t, T) [with T =
boost::_bi::bind_tboost::_bi::unspecified, void (gr::avg::a1_ff_impl::*)(),
boost::_bi::list2boost::_bi::valuegr::avg::a1_ff_impl*, boost::arg1  ;
pmt::pmt_t = boost::intrusive_ptrpmt::pmt_base]?
/home/neil/gr-avg/lib/a1_ff_impl.cc:49:44:   required from here
/usr/include/boost/function/function_template.hpp:153:11: error: no match for
call to ?(boost::_bi::bind_tboost::_bi::unspecified, void
(gr::avg::a1_ff_impl::*)(),
boost::_bi::list2boost::_bi::valuegr::avg::a1_ff_impl*, boost::arg1  )
(boost::intrusive_ptrpmt::pmt_base)?
  BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));

Re: [Discuss-gnuradio] message passing error

2014-01-25 Thread Johan Carlsson
Looks like there's something wrong with how you try to instantiate a 
struct from a trait. Possibly wrong template parameters?


The problem has nothing to do with GNU Radio per se.

You should check the boost documentation or some C++ resource, e.g. 
http://www.parashift.com/c++-faq/index.html


HTH, Johan

On Sat, 25 Jan 2014, MHMND Herath wrote:


I have problem with boost function
I put boost function as follows
a1_ff c++ file
   a1_ff_impl::a1_ff_impl()
 : gr::sync_block(a1_ff,
 gr::io_signature::make(1, 1, sizeof(double)),
 gr::io_signature::make(1, 1, sizeof(double)))
   {
message_port_register_in(pid);
set_msg_handler(pmt::mp(mout),
boost::bind(a1_ff_impl::mout, this , _1));
   }

I published mout in the a2_ff file
The error with boost function
Thanks
Neil
-- Original Message ---
From: Johan Carlsson jo...@lowestorder.org
To: MHMND Herath mh...@ou.ac.lk
Cc: discuss-gnuradio@gnu.org
Sent: Sat, 25 Jan 2014 09:41:07 -0500 (EST)
Subject: Re: [Discuss-gnuradio] message passing error


Looks like a a C++ or boost question?

Are you experienced in using C++ templates?

Regards,
Johan

On Sat, 25 Jan 2014, MHMND Herath wrote:



Dear Sir
When I trying to implement message passing between 2 blocks called a1_ff and
a2_ff following error comes when comiling. I cannot trace it.
Thanks
Neil
-
Scanning dependencies of target gnuradio-avg
[  5%] Building CXX object lib/CMakeFiles/gnuradio-avg.dir/a1_ff_impl.cc.o
In file included from /usr/include/boost/bind.hpp:22:0,
from /usr/include/boost/thread/detail/thread.hpp:29,
from /usr/include/boost/thread/thread.hpp:22,
from /usr/local/include/gnuradio/thread/thread.h:26,
from /usr/local/include/gnuradio/basic_block.h:31,
from /usr/local/include/gnuradio/block.h:27,
from /usr/local/include/gnuradio/sync_block.h:27,
from /home/neil/gr-avg/include/avg/a1_ff.h:26,
from /home/neil/gr-avg/lib/a1_ff_impl.h:23,
from /home/neil/gr-avg/lib/a1_ff_impl.cc:26:
/usr/include/boost/bind/bind.hpp: In instantiation of ?struct
boost::_bi::result_traitsboost::_bi::unspecified, void
(gr::avg::a1_ff_impl::*)()?:
/usr/include/boost/bind/bind_template.hpp:15:48:   required from ?class
boost::_bi::bind_tboost::_bi::unspecified, void (gr::avg::a1_ff_impl::*)(),
boost::_bi::list2boost::_bi::valuegr::avg::a1_ff_impl*, boost::arg1  ?
/home/neil/gr-avg/lib/a1_ff_impl.cc:49:43:   required from here
/usr/include/boost/bind/bind.hpp:69:37: error: ?void
(gr::avg::a1_ff_impl::*)()? is not a class, struct, or union type
typedef typename F::result_type type;
^
In file included from

/usr/include/boost/function/detail/maybe_include.hpp:18:0,

from

/usr/include/boost/function/detail/function_iterate.hpp:14,

from
/usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
from /usr/include/boost/function.hpp:64,
from /usr/local/include/gnuradio/basic_block.h:33,
from /usr/local/include/gnuradio/block.h:27,
from /usr/local/include/gnuradio/sync_block.h:27,
from /home/neil/gr-avg/include/avg/a1_ff.h:26,
from /home/neil/gr-avg/lib/a1_ff_impl.h:23,
from /home/neil/gr-avg/lib/a1_ff_impl.cc:26:
/usr/include/boost/function/function_template.hpp: In instantiation of ?static
void boost::detail::function::void_function_obj_invoker1FunctionObj, R,
T0::invoke(boost::detail::function::function_buffer, T0) [with FunctionObj =
boost::_bi::bind_tboost::_bi::unspecified, void (gr::avg::a1_ff_impl::*)(),
boost::_bi::list2boost::_bi::valuegr::avg::a1_ff_impl*, boost::arg1  ;
R = void; T0 = boost::intrusive_ptrpmt::pmt_base]?:
/usr/include/boost/function/function_template.hpp:934:38:   required from
?void boost::function1R, T1::assign_to(Functor) [with Functor =
boost::_bi::bind_tboost::_bi::unspecified, void (gr::avg::a1_ff_impl::*)(),
boost::_bi::list2boost::_bi::valuegr::avg::a1_ff_impl*, boost::arg1  ;
R = void; T0 = boost::intrusive_ptrpmt::pmt_base]?
/usr/include/boost/function/function_template.hpp:722:7:   required from
?boost::function1R, T1::function1(Functor, typename


boost::enable_if_cboost::type_traits::ice_notboost::is_integralFunctor::value::value,

int::type) [with Functor = boost::_bi::bind_tboost::_bi::unspecified, void
(gr::avg::a1_ff_impl::*)(),
boost::_bi::list2boost::_bi::valuegr::avg::a1_ff_impl*, boost::arg1  ;
R = void; T0 = boost::intrusive_ptrpmt::pmt_base; typename


boost::enable_if_cboost::type_traits::ice_notboost::is_integralFunctor::value::value,

int::type = int]?
/usr/include/boost/function/function_template.hpp:1069:16:   required from
?boost::functionR(T0)::function(Functor, typename


boost::enable_if_cboost::type_traits::ice_notboost

Re: [Discuss-gnuradio] Message passing as input and output in block (C++ coding)

2012-10-09 Thread Josh Blum

 I generated the BLOB_METADATA as pmt::pmt_t type. However, I cannot post
 blob_data because is related to _msg (in the previous example), which is a
 gr_tag_t type.
 

There are two post_msg methods. The key/value version of the method is a
convenience method that makes a gr_tag_t and sets key and value

https://github.com/guruofquality/grextras/blob/master/include/gnuradio/block.h#L208

 If a copy this blob for example to a new blob as you suggested previously,
 can I then post using: this-post_msg(0, BLOB_METADATA,blob_data, _id); ?.
 I mean, will it change to pmt_t type?.

The value parameter has to be type pmt::pmt_t

There is a function to create a blob from ptr and length:
http://gnuradio.org/cgit/gnuradio.git/tree/gruel/src/include/gruel/pmt.h#n330

-josh

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


Re: [Discuss-gnuradio] Message passing as input and output in block (C++ coding)

2012-10-09 Thread Jose Torres Diaz
Hi Josh,

I've checked this information and it is very useful. I've solved several
issues that I had before. However, it is still complaining when I post a
BLOB_METADATA (which is a pmt_list) downstream. What I have is the
following:

BLOCK 1  ---  BLOCK 2 (both blocks use message passing as blobs)

*In BLOCK 1 (work function):*

 while (_offset == 0){
 _msg = this-pop_msg_queue(); //Reading the incoming blob
   if (pmt::pmt_is_blob(_msg.value))
 {
 std::cout  std::endl  found a blob in BLOCK 1  std::endl;
 break; }
   }
   if (pmt::pmt_blob_length(_msg.value) == 0)
 {
 std::cout  std::endl  empty blob in BLOCK 1  std::endl;
 return -1;}

pmt::pmt_t BLOB_METADATA = pmt_list3(blob_key,blob_key2,blob_key3);
//For debugging
std::cout  std::endl  Making a list  std::endl;
std::cout  std::endl  this is the list: BLOB_METADATA
std::endl;

 this-post_msg(0,BLOB_METADATA,_msg.value,_id);  //BLOB_METADATA is a
list


*In BLOCK 2 (work function):*

 while (_offset == 0){
_msg = this-pop_msg_queue(); //Reading the incoming blob
 if (pmt::pmt_is_blob(_msg.value))
   {
 std::cout  std::endl  found a blob in -BLOCK 2  std::endl;
 break; }
}
 if (pmt::pmt_blob_length(_msg.value) == 0)
   {
 std::cout  std::endl  empty blob in BLOCK 2  std::endl;
 return -1;} //empty blob, we are done here

this-post_msg(0,_msg); //Pass the message as it is

//For debugging
 std::cout  std::endl  posting a message downstream  std::endl;
 std::cout  std::endl  DEBUG FROM BLOB TO BLOB 10/10  std::endl;
 std::cout  boost::format(value previous block=%8d, id previous
block=%16s )
 %_msg.value
 %_msg.srcid

I'm passing a message from BLOCK 1 to BLOCK 2, then I changed the key value
and I replaced it as a list (BLOB_METADATA). Everything is running, but it
seems to be that the message is not passed from BLOCK 1 to BLOCK 2, here is
my errors in GNU Radio Companion:
*
thread[thread-per-block[8]: gr_block msg_sourcer (9)]:
gr_block_detail::add_item_tag key: wrong_type : (st2_uplink burst_start_key
burst_bb_gain)*

Note: st2_uplink burst_start_key burst_bb_gain is the value inside blob1,
blob2 and blob3 in the list

Is there any restrictions passing a pmt_list from one block to another?, or
is there any constraint when I read the incoming blob from BLOCK 1 into
BLOCK 2?.

Thanks a lot for your help,

Regards,

Jose

On Wed, Oct 10, 2012 at 9:14 AM, Josh Blum j...@ettus.com wrote:


  I generated the BLOB_METADATA as pmt::pmt_t type. However, I cannot post
  blob_data because is related to _msg (in the previous example), which is
 a
  gr_tag_t type.
 

 There are two post_msg methods. The key/value version of the method is a
 convenience method that makes a gr_tag_t and sets key and value


 https://github.com/guruofquality/grextras/blob/master/include/gnuradio/block.h#L208

  If a copy this blob for example to a new blob as you suggested
 previously,
  can I then post using: this-post_msg(0, BLOB_METADATA,blob_data, _id);
 ?.
  I mean, will it change to pmt_t type?.

 The value parameter has to be type pmt::pmt_t

 There is a function to create a blob from ptr and length:

 http://gnuradio.org/cgit/gnuradio.git/tree/gruel/src/include/gruel/pmt.h#n330

 -josh

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


Re: [Discuss-gnuradio] Message passing as input and output in block (C++ coding)

2012-10-09 Thread Jose Torres Diaz
Hi Josh,

I've check the documentation and also my variables. I've found that my list
is a PMT pair or PMT dict:

std::cout  std::endl  checking if pair:
pmt::pmt_is_pair(BLOB_METADATA) std::endl; //This gave me true
std::cout  std::endl  checking if dict:
pmt::pmt_is_dict(BLOB_METADATA) std::endl; //This gave me true

So, when I have to post the message downstream, I am using as follows:

this-post_msg(0,BLOB_METADATA,_msg.value,_id);  //BLOB_METADATA is a list

However, BLOB_METADATA should be symbol type (
http://gnuradio.org/doc/doxygen/classgr__block.html#a7578dece9d597abe61db91aae8a0df83).
In my case, it is a list which is PMT dict type.

Is there any way that I can post this list?, I mean, is there any way that
I can convert PMT dict type into PMT symb type?.

Thanks for your help,

Jose.


On Wed, Oct 10, 2012 at 2:22 PM, Jose Torres Diaz torresdiaz.j...@gmail.com
 wrote:

 Hi Josh,

 I've checked this information and it is very useful. I've solved several
 issues that I had before. However, it is still complaining when I post a
 BLOB_METADATA (which is a pmt_list) downstream. What I have is the
 following:

 BLOCK 1  ---  BLOCK 2 (both blocks use message passing as blobs)

 *In BLOCK 1 (work function):*


  while (_offset == 0){
  _msg = this-pop_msg_queue(); //Reading the incoming blob
if (pmt::pmt_is_blob(_msg.value))
  {
  std::cout  std::endl  found a blob in BLOCK 1  std::endl;

  break; }
}
if (pmt::pmt_blob_length(_msg.value) == 0)
  {
  std::cout  std::endl  empty blob in BLOCK 1  std::endl;
  return -1;}

 pmt::pmt_t BLOB_METADATA = pmt_list3(blob_key,blob_key2,blob_key3);
 //For debugging
 std::cout  std::endl  Making a list  std::endl;
 std::cout  std::endl  this is the list: BLOB_METADATA
 std::endl;

  this-post_msg(0,BLOB_METADATA,_msg.value,_id);  //BLOB_METADATA is a
 list


 *In BLOCK 2 (work function):*


  while (_offset == 0){
 _msg = this-pop_msg_queue(); //Reading the incoming blob
  if (pmt::pmt_is_blob(_msg.value))
{
  std::cout  std::endl  found a blob in -BLOCK 2  std::endl;

  break; }
 }
  if (pmt::pmt_blob_length(_msg.value) == 0)
{
  std::cout  std::endl  empty blob in BLOCK 2  std::endl;

  return -1;} //empty blob, we are done here

 this-post_msg(0,_msg); //Pass the message as it is

 //For debugging
  std::cout  std::endl  posting a message downstream  std::endl;
  std::cout  std::endl  DEBUG FROM BLOB TO BLOB 10/10 
 std::endl;
  std::cout  boost::format(value previous block=%8d, id previous
 block=%16s )
  %_msg.value
  %_msg.srcid

 I'm passing a message from BLOCK 1 to BLOCK 2, then I changed the key
 value and I replaced it as a list (BLOB_METADATA). Everything is running,
 but it seems to be that the message is not passed from BLOCK 1 to BLOCK 2,
 here is my errors in GNU Radio Companion:
 *
 thread[thread-per-block[8]: gr_block msg_sourcer (9)]:
 gr_block_detail::add_item_tag key: wrong_type : (st2_uplink burst_start_key
 burst_bb_gain)*

 Note: st2_uplink burst_start_key burst_bb_gain is the value inside blob1,
 blob2 and blob3 in the list

 Is there any restrictions passing a pmt_list from one block to another?,
 or is there any constraint when I read the incoming blob from BLOCK 1 into
 BLOCK 2?.

 Thanks a lot for your help,

 Regards,

 Jose


 On Wed, Oct 10, 2012 at 9:14 AM, Josh Blum j...@ettus.com wrote:


  I generated the BLOB_METADATA as pmt::pmt_t type. However, I cannot post
  blob_data because is related to _msg (in the previous example), which
 is a
  gr_tag_t type.
 

 There are two post_msg methods. The key/value version of the method is a
 convenience method that makes a gr_tag_t and sets key and value


 https://github.com/guruofquality/grextras/blob/master/include/gnuradio/block.h#L208

  If a copy this blob for example to a new blob as you suggested
 previously,
  can I then post using: this-post_msg(0, BLOB_METADATA,blob_data, _id);
 ?.
  I mean, will it change to pmt_t type?.

 The value parameter has to be type pmt::pmt_t

 There is a function to create a blob from ptr and length:

 http://gnuradio.org/cgit/gnuradio.git/tree/gruel/src/include/gruel/pmt.h#n330

 -josh






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


Re: [Discuss-gnuradio] Message passing as input and output in block (C++ coding)

2012-10-08 Thread Josh Blum


On 10/07/2012 09:56 PM, Jose Torres Diaz wrote:
 Hi All,
 
 I have another question about the message passing technique. In this
 opportunity, I would like to create a block that takes message as input,
 but also that post message downstream as output. In my initial attempt, I'm
 using the original blob_to_stream example (see below), the incoming message
 is taken using:
 
 _msg = this-pop_msg_queue();
 
 and then, in order to output the incoming message, it is used:
 
 std::memcpy(output_items[0].get(), blob_mem, noutput_bytes);
 
 However,
 
 *(1) Is it possible to use an alternative way like this:
 
 post_msg(0,_msg.key, _msg.value,_id);   ?


Yes, absolutely. This is the correct way to pass the message downstream.

-josh

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


Re: [Discuss-gnuradio] Message passing as input and output in block (C++ coding)

2012-10-08 Thread Jose Torres Diaz
Hi Josh,

Thanks for the info. So, for example if I want to modify the blob_to_stream
example as blob_to_blob (ie. input a message and then output a message).
The .cc files is as shown below, but I got errors when I compile because of
the type of variables:

 In member function ‘virtual int blob_to_blob_impl::work(const InputItems,
const OutputItems)’:
/lib/blob_to_blob.cc:78:43: error: no matching function for call to
‘blob_to_blob_impl::post_msg(int, const pmt_t, const char*, pmt::pmt_t)’
/lib/blob_to_blob.cc:78:43: note: candidates are:
/grextras/include/gnuradio/block.h:204:10: note: void
gnuradio::block::post_msg(size_t, const gr_tag_t)
/grextras/include/gnuradio/block.h:204:10: note:   candidate expects 2
arguments, 4 provided
/grextras/include/gnuradio/block.h:215:10: note: void
gnuradio::block::post_msg(size_t, const pmt_t, const pmt_t, const pmt_t)
/grextras/include/gnuradio/block.h:215:10: note:   no known conversion for
argument 3 from ‘const char*’ to ‘const pmt_t {aka const
boost::intrusive_ptrpmt::pmt_base}’

The file blob_to_blob.cc is:

#include gnuradio/extras/blob_to_blob.h
#include gr_io_signature.h
#include cstring //std::memcpy

using namespace gnuradio::extras;

static const pmt::pmt_t BLOB_KEY =
pmt::pmt_string_to_symbol(blob_stream); //From stream to blob

class blob_to_blob_impl : public blob_to_blob{
public:
   blob_to_blob_impl(const size_t item_size):
block(
  blob_to_blob,
gr_make_io_signature(0, 0, 0),
gr_make_io_signature(1, 1, item_size),
msg_signature(true, 1)
),
_item_size(item_size)
{
_offset = 0;

//From stream to blob example
std::stringstream str;
str  name()  unique_id();
_id = pmt::pmt_string_to_symbol(str.str());

}

int work(
const InputItems input_items,
const OutputItems output_items
){
//Here the blob is received
//loop until we get a blob or interrupted
while (_offset == 0){
  _msg = this-pop_msg_queue(); //Reading the incoming blob
if (pmt::pmt_is_blob(_msg.value)) break;
}
if (pmt::pmt_blob_length(_msg.value) == 0) return -1; //empty blob,
we are done here


//calculate the number of bytes to copy
const size_t nblob_items = (pmt::pmt_blob_length(_msg.value) -
_offset)/_item_size;
const size_t noutput_bytes =
_item_size*std::minsize_t(output_items[0].size(), nblob_items);

//perform memcpy from blob to output items
const char *blob_mem = reinterpret_castconst char
*(pmt::pmt_blob_data(_msg.value)) + _offset;
//std::memcpy(output_items[0].get(), blob_mem, noutput_bytes);
//Putting in the output blob_mem


//post the message to downstream subscribers
//this-post_msg(0, BLOB_KEY, blob, _id);
this-post_msg(0, BLOB_KEY, blob_mem, _id); //Using blob mem

//adjust the offset into the blob memory
_offset += noutput_bytes;
if (pmt::pmt_blob_length(_msg.value) == _offset) _offset = 0;

return noutput_bytes/_item_size;
}

private:
const size_t _item_size;
gr_tag_t _msg;
size_t _offset;
  pmt::pmt_t _id; //From strem to blob example
};

blob_to_blob::sptr blob_to_blob::make(const size_t item_size){
  return gnuradio::get_initial_sptr(new blob_to_blob_impl(item_size));
}

Many thanks again for your kind help,

Jose


On Tue, Oct 9, 2012 at 4:25 AM, Josh Blum j...@ettus.com wrote:



 On 10/07/2012 09:56 PM, Jose Torres Diaz wrote:
  Hi All,
 
  I have another question about the message passing technique. In this
  opportunity, I would like to create a block that takes message as input,
  but also that post message downstream as output. In my initial attempt,
 I'm
  using the original blob_to_stream example (see below), the incoming
 message
  is taken using:
 
  _msg = this-pop_msg_queue();
 
  and then, in order to output the incoming message, it is used:
 
  std::memcpy(output_items[0].get(), blob_mem, noutput_bytes);
 
  However,
 
  *(1) Is it possible to use an alternative way like this:
 
  post_msg(0,_msg.key, _msg.value,_id);   ?


 Yes, absolutely. This is the correct way to pass the message downstream.

 -josh

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


Re: [Discuss-gnuradio] Message passing as input and output in block (C++ coding)

2012-10-08 Thread Jose Torres Diaz
Hi Josh,

I've figured out this question. I just need to post

this-post_msg(0,_msg);

Since, _msg is a gr_tag_t. But, still is not clear for me how can I post a
message as follows:

this-post_msg(0, BLOB_METADATA,blob_data, _id); ?

I generated the BLOB_METADATA as pmt::pmt_t type. However, I cannot post
blob_data because is related to _msg (in the previous example), which is a
gr_tag_t type.

If a copy this blob for example to a new blob as you suggested previously,
can I then post using: this-post_msg(0, BLOB_METADATA,blob_data, _id); ?.
I mean, will it change to pmt_t type?.

Many thanks again,

Jose


On Tue, Oct 9, 2012 at 11:06 AM, Jose Torres Diaz torresdiaz.j...@gmail.com
 wrote:

 Hi Josh,

 Thanks for the info. So, for example if I want to modify the
 blob_to_stream example as blob_to_blob (ie. input a message and then output
 a message). The .cc files is as shown below, but I got errors when I
 compile because of the type of variables:

  In member function ‘virtual int blob_to_blob_impl::work(const
 InputItems, const OutputItems)’:
 /lib/blob_to_blob.cc:78:43: error: no matching function for call to
 ‘blob_to_blob_impl::post_msg(int, const pmt_t, const char*, pmt::pmt_t)’
 /lib/blob_to_blob.cc:78:43: note: candidates are:
 /grextras/include/gnuradio/block.h:204:10: note: void
 gnuradio::block::post_msg(size_t, const gr_tag_t)
 /grextras/include/gnuradio/block.h:204:10: note:   candidate expects 2
 arguments, 4 provided
 /grextras/include/gnuradio/block.h:215:10: note: void
 gnuradio::block::post_msg(size_t, const pmt_t, const pmt_t, const pmt_t)
 /grextras/include/gnuradio/block.h:215:10: note:   no known conversion for
 argument 3 from ‘const char*’ to ‘const pmt_t {aka const
 boost::intrusive_ptrpmt::pmt_base}’

 The file blob_to_blob.cc is:

 #include gnuradio/extras/blob_to_blob.h
 #include gr_io_signature.h
 #include cstring //std::memcpy

 using namespace gnuradio::extras;

 static const pmt::pmt_t BLOB_KEY =
 pmt::pmt_string_to_symbol(blob_stream); //From stream to blob

 class blob_to_blob_impl : public blob_to_blob{
 public:
blob_to_blob_impl(const size_t item_size):
 block(
   blob_to_blob,
 gr_make_io_signature(0, 0, 0),
 gr_make_io_signature(1, 1, item_size),
 msg_signature(true, 1)
 ),
 _item_size(item_size)
 {
 _offset = 0;

 //From stream to blob example
 std::stringstream str;
 str  name()  unique_id();
 _id = pmt::pmt_string_to_symbol(str.str());


 }

 int work(
 const InputItems input_items,
 const OutputItems output_items
 ){
 //Here the blob is received

 //loop until we get a blob or interrupted
 while (_offset == 0){
   _msg = this-pop_msg_queue(); //Reading the incoming blob

 if (pmt::pmt_is_blob(_msg.value)) break;
 }
 if (pmt::pmt_blob_length(_msg.value) == 0) return -1; //empty
 blob, we are done here


 //calculate the number of bytes to copy
 const size_t nblob_items = (pmt::pmt_blob_length(_msg.value) -
 _offset)/_item_size;
 const size_t noutput_bytes =
 _item_size*std::minsize_t(output_items[0].size(), nblob_items);

 //perform memcpy from blob to output items
 const char *blob_mem = reinterpret_castconst char
 *(pmt::pmt_blob_data(_msg.value)) + _offset;
 //std::memcpy(output_items[0].get(), blob_mem, noutput_bytes);
 //Putting in the output blob_mem


 //post the message to downstream subscribers
 //this-post_msg(0, BLOB_KEY, blob, _id);
 this-post_msg(0, BLOB_KEY, blob_mem, _id); //Using blob mem


 //adjust the offset into the blob memory
 _offset += noutput_bytes;
 if (pmt::pmt_blob_length(_msg.value) == _offset) _offset = 0;

 return noutput_bytes/_item_size;
 }

 private:
 const size_t _item_size;
 gr_tag_t _msg;
 size_t _offset;
   pmt::pmt_t _id; //From strem to blob example
 };

 blob_to_blob::sptr blob_to_blob::make(const size_t item_size){
   return gnuradio::get_initial_sptr(new blob_to_blob_impl(item_size));
 }

 Many thanks again for your kind help,

 Jose



 On Tue, Oct 9, 2012 at 4:25 AM, Josh Blum j...@ettus.com wrote:



 On 10/07/2012 09:56 PM, Jose Torres Diaz wrote:
  Hi All,
 
  I have another question about the message passing technique. In this
  opportunity, I would like to create a block that takes message as input,
  but also that post message downstream as output. In my initial attempt,
 I'm
  using the original blob_to_stream example (see below), the incoming
 message
  is taken using:
 
  _msg = this-pop_msg_queue();
 
  and then, in order to output the incoming message, it is used:
 
  std::memcpy(output_items[0].get(), blob_mem, noutput_bytes);
 
  However,
 
  *(1) Is it possible to use an alternative way like this:
 
  post_msg(0,_msg.key, _msg.value,_id);   ?


 Yes, absolutely. This is the correct way to pass the message 

Re: [Discuss-gnuradio] Message passing - PSDU block and sink connection

2012-09-26 Thread Josh Blum


On 09/26/2012 12:47 AM, Jose Torres Diaz wrote:
 Hi,
 
 I've just finished my block that generates PSDUs and then, it transmits
 downstream subscribers using message passing mechanism. I am using as a
 sink Extras: Blob to Socket, but when I run my flowgraph in GNU Radio
 Companion (after connect my new block and the sink), I got the following
 error:
 
 Traceback (most recent call last):
   File /home/usrpvm/Desktop/only_test_block/asrp/top_block.py, line 51,
 in module
 tb = top_block()
   File /home/usrpvm/Desktop/only_test_block/asrp/top_block.py, line 33,
 in __init__
 0, 0, 0, 0, 0, 1, 1, 1)
 TypeError: unbound method make() must be called with my_block instance as
 first argument (got int instance instead)
 

I think the code getting generated is malformed. You might double check
make and the code in top_block.py

-josh

 I would really appreciate some help with this issue. Thanks a lot,
 
 Regards,
 
 Jose
 

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


Re: [Discuss-gnuradio] Message passing - PSDU block and sink connection

2012-09-25 Thread Josh Blum


On 09/26/2012 12:47 AM, Jose Torres Diaz wrote:
 Hi,
 
 I've just finished my block that generates PSDUs and then, it transmits
 downstream subscribers using message passing mechanism. I am using as a
 sink Extras: Blob to Socket, but when I run my flowgraph in GNU Radio
 Companion (after connect my new block and the sink), I got the following
 error:
 
 Traceback (most recent call last):
   File /home/usrpvm/Desktop/only_test_block/asrp/top_block.py, line 51,
 in module
 tb = top_block()
   File /home/usrpvm/Desktop/only_test_block/asrp/top_block.py, line 33,
 in __init__
 0, 0, 0, 0, 0, 1, 1, 1)
 TypeError: unbound method make() must be called with my_block instance as
 first argument (got int instance instead)
 
 I would really appreciate some help with this issue. Thanks a lot,
 
 Regards,
 
 Jose
 

Can you post your xml and .i file?

-josh

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


Re: [Discuss-gnuradio] Message passing - PSDU block and sink connection

2012-09-25 Thread Jose Torres Diaz
Hi Josh,

I've attached the xml file for my_block.xml. I don't have a .i file (like
my_block.i), because it is using the extras_blobs.i file. I've attached
for you extras_blob.i and I added some lines to that .i file in order to
include my_block.

All the example is based on blob to stream and socket to block.

Many thanks for your kind help,

Regards,

Jose

On Wed, Sep 26, 2012 at 2:18 PM, Josh Blum j...@ettus.com wrote:



 On 09/26/2012 12:47 AM, Jose Torres Diaz wrote:
  Hi,
 
  I've just finished my block that generates PSDUs and then, it transmits
  downstream subscribers using message passing mechanism. I am using as a
  sink Extras: Blob to Socket, but when I run my flowgraph in GNU Radio
  Companion (after connect my new block and the sink), I got the following
  error:
 
  Traceback (most recent call last):
File /home/usrpvm/Desktop/only_test_block/asrp/top_block.py, line 51,
  in module
  tb = top_block()
File /home/usrpvm/Desktop/only_test_block/asrp/top_block.py, line 33,
  in __init__
  0, 0, 0, 0, 0, 1, 1, 1)
  TypeError: unbound method make() must be called with my_block instance as
  first argument (got int instance instead)
 
  I would really appreciate some help with this issue. Thanks a lot,
 
  Regards,
 
  Jose
 

 Can you post your xml and .i file?

 -josh

/*
 * Copyright 2012 Free Software Foundation, Inc.
 * 
 * This file is part of GNU Radio
 * 
 * GNU Radio is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 * 
 * GNU Radio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with GNU Radio; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */


// block headers

%{
#include gnuradio/extras/blob_to_filedes.h
#include gnuradio/extras/blob_to_socket.h
#include gnuradio/extras/blob_to_stream.h
#include gnuradio/extras/filedes_to_blob.h
#include gnuradio/extras/socket_to_blob.h
#include gnuradio/extras/stream_to_blob.h
#include gnuradio/extras/tuntap.h
#include gnuradio/extras/msg_many_to_one.h
#include gnuradio/extras/my_block.h
%}

%include gnuradio/extras/blob_to_filedes.h
%include gnuradio/extras/blob_to_socket.h
%include gnuradio/extras/blob_to_stream.h
%include gnuradio/extras/filedes_to_blob.h
%include gnuradio/extras/socket_to_blob.h
%include gnuradio/extras/stream_to_blob.h
%include gnuradio/extras/tuntap.h
%include gnuradio/extras/msg_many_to_one.h
%include gnuradio/extras/my_block.h


// block magic

using namespace gnuradio::extras;
GR_EXTRAS_SWIG_BLOCK_FACTORY(blob_to_filedes)
GR_EXTRAS_SWIG_BLOCK_FACTORY(blob_to_socket)
GR_EXTRAS_SWIG_BLOCK_FACTORY(blob_to_stream)
GR_EXTRAS_SWIG_BLOCK_FACTORY(filedes_to_blob)
GR_EXTRAS_SWIG_BLOCK_FACTORY(socket_to_blob)
GR_EXTRAS_SWIG_BLOCK_FACTORY(stream_to_blob)
GR_EXTRAS_SWIG_BLOCK_FACTORY(tuntap)
GR_EXTRAS_SWIG_BLOCK_FACTORY(msg_many_to_one)
GR_EXTRAS_SWIG_BLOCK_FACTORY(my_block)
?xml version=1.0?
!--
###
## ST1 Dummy Packet using message passing
###
 --
block
nameMy Block/name
keyextras_my_block/key
categoryASRP/category
importimport gnuradio.extras as gr_extras/import
 
  !-- makegr_extras.my_block($item_size)/make //original--

 makegr_extras.my_block($mode, $pkt_len, $max_pkts, $freq_mode, $freq_min, 
$freq_max, $freq_delta,
  $delay_mode, $delay_min, $delay_max, $delay_delta, $combine_mode, 
$combine_min, $combine_max, $combine_delta)
  /make
 
 !-- param
nameOutput Item Size/name
keyitem_size/key
value1/value
typeint/type
/param #I don't need this parameter--

  param
namePSDU Generation Mode/name
keymode/key
typeenum/type
option
  nameIncrementing Bytes/name
  key2/key
/option
option
  nameAll Zeros/name
  key0/key
/option
option
  nameAll Ones/name
  key1/key
/option
  /param

  param
namePSDU Length/name
keypkt_len/key
value29/value
typeint/type
  /param

 param
nameMax Packets/name
keymax_pkts/key
value10/value
typeint/type
  /param

 param
nameFrequency Shift Mode/name
keyfreq_mode/key
value0/value
typeint/type
option
  nameFixed (use min)/name