[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] switching between two flow-graphs / controlling t
From: |
Tom Rondeau |
Subject: |
Re: [Discuss-gnuradio] switching between two flow-graphs / controlling two flow-graphs |
Date: |
Sun, 31 Jul 2011 17:33:16 -0400 |
On Fri, Jul 29, 2011 at 9:33 AM, Edmar Candeia Gurjao
<address@hidden> wrote:
> 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
This patch was applied to the code in the tree. Is it not working?
Tom
> 2011/7/29 niaz ahmed <address@hidden>
>>
>> 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 Ahmed
>>
>>
>>
>> “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
>>
>>
>>
>> _______________________________________________
>> Discuss-gnuradio mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>
>
>
> --
> ---------------
> Edmar Candeia Gurjão
> Universidade Federal de Campina Grande.
> +55 83 2101 1403
> http://ecandeia.dee.ufcg.edu.br
> http://pet.ee.ufcg.edu.br/
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>