Re: [Discuss-gnuradio] issue about message port of grextras

2014-04-24 Thread Damon
I got it. If the message port defined in grextras is disconnected, the 
message sink or source block will not in the flowgraph.

Thanks Tom.

Best regards,
Damon

On Thu, Apr 24, 2014 at 12:01 AM, Damon > wrote:


Hi Tom,

Thanks for you reply.

I am wondering why the data stream ports of byte or integer 8
could be disconnected by other ports.

Here is an example. The connecting code is commented out, but we
can run this program without getting a error.

#!/usr/bin/env python
##
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Thu Apr 24 11:57:08 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 optparse import OptionParser

class top_block(gr.top_block):

def __init__(self):
gr.top_block.__init__(self, "Top Block")

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

##
# Blocks
##
self.blocks_null_source_0 =
blocks.null_source(gr.sizeof_char*1)
self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char*1)

##
# Connections
##
#self.connect((self.blocks_null_source_0, 0),
(self.blocks_null_sink_0, 0))


# 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__':
parser = OptionParser(option_class=eng_option, usage="%prog:
[options]")
(options, args) = parser.parse_args()
tb = top_block()
tb.start()
raw_input('Press Enter to quit: ')
tb.stop()
tb.wait()



Best regards,
Damon



I really don't understand the question. Why do you think this behavior 
is wrong? There are no blocks in the flowgraph; that's not a condition 
to say it won't run. When you hit start, it'll try to start all 
threads; there are none, so it will immediately exit. The raw_input is 
a Python thing, so that will continue to block.


Tom


2014-04-23 21:46 GMT+08:00 Tom Rondeau mailto:t...@trondeau.com>>:

On Tue, Apr 22, 2014 at 5:09 AM, Damon
mailto:qiu.guowang...@gmail.com>>
wrote:

Hi all,

Recently I am learning the grextras project. I am confused
about the
message port which is designed in grextras.
Why will we not get a error when the message ports do not
connect to
other message ports? I thought those port actually is data
stream ports,
so they should be connected to other ports.

Best regards,
Damon


Damon,
grextras is an external project from GNU Radio and not related
to the core functionality.

But GNU Radio's message passing structure does not require
connections. It's a publish-subscribe model, and a block will
publish a message regardless of whether or not another block
is subscribed and listening.

Tom





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


Re: [Discuss-gnuradio] issue about message port of grextras

2014-04-24 Thread Tom Rondeau
On Thu, Apr 24, 2014 at 12:01 AM, Damon  wrote:

> Hi Tom,
>
> Thanks for you reply.
>
> I am wondering why the data stream ports of byte or integer 8 could be
> disconnected by other ports.
>
> Here is an example. The connecting code is commented out, but we can run
> this program without getting a error.
>
> #!/usr/bin/env python
> ##
> # Gnuradio Python Flow Graph
> # Title: Top Block
> # Generated: Thu Apr 24 11:57:08 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 optparse import OptionParser
>
> class top_block(gr.top_block):
>
> def __init__(self):
> gr.top_block.__init__(self, "Top Block")
>
> ##
> # Variables
> ##
> self.samp_rate = samp_rate = 32000
>
> ##
> # Blocks
> ##
> self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char*1)
> self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char*1)
>
> ##
> # Connections
> ##
> #self.connect((self.blocks_null_source_0, 0),
> (self.blocks_null_sink_0, 0))
>
>
> # 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__':
> parser = OptionParser(option_class=eng_option, usage="%prog:
> [options]")
> (options, args) = parser.parse_args()
> tb = top_block()
> tb.start()
> raw_input('Press Enter to quit: ')
> tb.stop()
> tb.wait()
>
>
>
> Best regards,
> Damon
>


I really don't understand the question. Why do you think this behavior is
wrong? There are no blocks in the flowgraph; that's not a condition to say
it won't run. When you hit start, it'll try to start all threads; there are
none, so it will immediately exit. The raw_input is a Python thing, so that
will continue to block.

Tom




> 2014-04-23 21:46 GMT+08:00 Tom Rondeau :
>
> On Tue, Apr 22, 2014 at 5:09 AM, Damon  wrote:
>>
>>> Hi all,
>>>
>>> Recently I am learning the grextras project. I am confused about the
>>> message port which is designed in grextras.
>>> Why will we not get a error when the message ports do not connect to
>>> other message ports? I thought those port actually is data stream ports,
>>> so they should be connected to other ports.
>>>
>>> Best regards,
>>> Damon
>>>
>>
>> Damon,
>> grextras is an external project from GNU Radio and not related to the
>> core functionality.
>>
>> But GNU Radio's message passing structure does not require connections.
>> It's a publish-subscribe model, and a block will publish a message
>> regardless of whether or not another block is subscribed and listening.
>>
>> Tom
>>
>>
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] issue about message port of grextras

2014-04-23 Thread Damon
Hi Tom,

Thanks for you reply.

I am wondering why the data stream ports of byte or integer 8 could be
disconnected by other ports.

Here is an example. The connecting code is commented out, but we can run
this program without getting a error.

#!/usr/bin/env python
##
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Thu Apr 24 11:57:08 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 optparse import OptionParser

class top_block(gr.top_block):

def __init__(self):
gr.top_block.__init__(self, "Top Block")

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

##
# Blocks
##
self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char*1)
self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char*1)

##
# Connections
##
#self.connect((self.blocks_null_source_0, 0),
(self.blocks_null_sink_0, 0))


# 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__':
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
(options, args) = parser.parse_args()
tb = top_block()
tb.start()
raw_input('Press Enter to quit: ')
tb.stop()
tb.wait()



Best regards,
Damon


2014-04-23 21:46 GMT+08:00 Tom Rondeau :

> On Tue, Apr 22, 2014 at 5:09 AM, Damon  wrote:
>
>> Hi all,
>>
>> Recently I am learning the grextras project. I am confused about the
>> message port which is designed in grextras.
>> Why will we not get a error when the message ports do not connect to
>> other message ports? I thought those port actually is data stream ports,
>> so they should be connected to other ports.
>>
>> Best regards,
>> Damon
>>
>
> Damon,
> grextras is an external project from GNU Radio and not related to the core
> functionality.
>
> But GNU Radio's message passing structure does not require connections.
> It's a publish-subscribe model, and a block will publish a message
> regardless of whether or not another block is subscribed and listening.
>
> Tom
>
>
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] issue about message port of grextras

2014-04-23 Thread Tom Rondeau
On Tue, Apr 22, 2014 at 5:09 AM, Damon  wrote:

> Hi all,
>
> Recently I am learning the grextras project. I am confused about the
> message port which is designed in grextras.
> Why will we not get a error when the message ports do not connect to
> other message ports? I thought those port actually is data stream ports,
> so they should be connected to other ports.
>
> Best regards,
> Damon
>

Damon,
grextras is an external project from GNU Radio and not related to the core
functionality.

But GNU Radio's message passing structure does not require connections.
It's a publish-subscribe model, and a block will publish a message
regardless of whether or not another block is subscribed and listening.

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