Switching between two flow-graphs / controlling two flow-graphs

Hi,

I am working on an application ( half duplex communication ) where i
have
two flow graphs receiver and transmitter. the scenario is that the
receiver
should always be running but when the application require to send
something
the receiver flow-graph should be stopped at that time. the reason for
the
receiver flow-graph to be stopped is obvious that it should not receive
the
data it is sending. i am using laptop sound card (not usrp).

i am trying to stop the receiver and start it once the transmitter queue
becomes empty but i am getting the following error when i restart the
graph

audio_alsa_source[plughw:0,0]: snd_pcm_hw_params failed: File descriptor
in
bad state

class receive_graph(gr.top_block):

def __init__(self):
    gr.top_block.__init__(self)

    self.rcvd_pktq = gr.msg_queue()

 #
 #some processing blocks here
     #

 self.connect(src,//blocks//,sink)

class transmit_graph(gr.top_block):

def __init__(self):
    gr.top_block.__init__(self)
    audio_rate =8000
    self.src = gr.message_source(gr.sizeof_char, msgq_limit)

  #
 #some processing blocks here
     #

speaker = audio.sink(audio_rate, "plughw:0,0");
self.connect(src,//blocks//,speaker)

if name == ‘main’:
try:
fg1 = freceive_graph()
fg1.start()
fg= transmit_graph()
fg.start()

    try:



    while True:
         message = raw_input("Enter a message to transmit (Ctrl-D to

exit): ")
fg1.stop() #here i am stopping the receiver
graph
#
# here i am making pkt from the message
#
fg.src.msgq().insert_tail(pkt)
if fg.src.msgq().empty_p():
fg1.start()

    except EOFError:
           print "\nExiting."
           fg.src.msgq().insert_tail(gr.message(1))
           fg.wait()

Main python entry

except KeyboardInterrupt:
    pass


Niaz A.

We are always more anxious to be distinguished for a talent which we do
not
possess, than to be praised for the fifteen which we do possess* :
Mark
Twain http://thinkexist.com/quotes/mark_twain/*

Hi,

there is a patch in the mailing list to this problem in the patch
mailing
list
http://lists.gnu.org/archive/html/patch-gnuradio/2011-07/msg00001.html

I have aplied and it works,

Edmar

2011/7/29 niaz ahmed [email protected]

On Fri, Jul 29, 2011 at 9:33 AM, Edmar Candeia G.
[email protected] wrote:

Hi,

there is a patch in the mailing list to this problem in the patch mailing
list [Patch-gnuradio] audio_alsa_source.cc: Check pcm state before messing wi

I have aplied and it works,

Edmar

This patch was applied to the code in the tree. Is it not working?

Tom

On Mon, Aug 1, 2011 at 12:04 AM, Edmar Candeia G. <
[email protected]> wrote:

[email protected] wrote:

Hi,

there is a patch in the mailing list to this problem in the patch
mailing
list
[Patch-gnuradio] audio_alsa_source.cc: Check pcm state before messing wi

I have aplied and it works,

Thanks Edmar for sharing the link.


 I am using ubuntu 10.10 (maverick) and have installed GNU Radio 3.2

from binary
packagehttp://gnuradio.org/redmine/projects/gnuradio/wiki/DebianPackagess
.
And i think this is the reason i cant find the source files, so how
could i
apply the patch. Should i re-install GnuRadio from the source code
or i
have some other options to work it out.


Niaz A.

We are always more anxious to be distinguished for a talent which we do
not
possess, than to be praised for the fifteen which we do possess* :
Mark
Twain http://thinkexist.com/quotes/mark_twain/*

Tom,

last time I got gnuradio using git the path I had to apply the patch,

Edmar

2011/7/31 Tom R. [email protected]

Hi Niaz,

I had the exactly this problem. To solve it, I download source code from
git, to apply the path and before this I install from the source code
(./configure, make, etc.). As the final observation I must run sudo
./ldconfig after installation and before to use gnuradio,

Edmar

2011/8/2 niaz ahmed [email protected]

On Tue, Aug 2, 2011 at 7:15 AM, Edmar Candeia G.
[email protected] wrote:

Hi Niaz,

I had the exactly this problem. To solve it, I download source code from
git, to apply the path and before this I install from the source code
(./configure, make, etc.). As the final observation I must run sudo
./ldconfig after installation and before to use gnuradio,

Edmar

Ok, this patch has been applied to maint/master/next. I thought I had
done this when it was posted to the patch list, but something much has
gone wrong.

Tom

I had the exactly this problem. To solve it, I download source code from
git, to apply the path and before this I install from the source code
(./configure, make, etc.). As the final observation I must run sudo
./ldconfig after installation and before to use gnuradio,

Edmar

Thanks Edmar for helping me out. I did the same as you told and the
problem
is solved.


Niaz A.

We are always more anxious to be distinguished for a talent which we do
not
possess, than to be praised for the fifteen which we do possess* :
Mark
Twain http://thinkexist.com/quotes/mark_twain/*