discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] switching between two flow-graphs / controlling two f


From: niaz ahmed
Subject: [Discuss-gnuradio] switching between two flow-graphs / controlling two flow-graphs
Date: Fri, 29 Jul 2011 12:47:51 +0000

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 = "" 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]