[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Editing benchmark_rx.py for spectrum access
From: |
Dan Rosenqvist |
Subject: |
Re: [Discuss-gnuradio] Editing benchmark_rx.py for spectrum access |
Date: |
Mon, 3 Aug 2009 01:07:20 -0700 (PDT) |
Ali Siddiqi wrote:
>
> Hi,
> Did the flowgraph of the code (in which you added the timeout) involved
> receive_path???
>
> Regards,
> Ali
>
> On Mon, Aug 3, 2009 at 11:21 AM, Dan Rosenqvist <address@hidden> wrote:
>
>>
>>
>>
>> Umair Nasir wrote:
>> >
>> > Hi all,
>> >
>> > This question is asked a number of times. And I believe it shouldn't be
>> > that
>> > tough. Somebody explain where to put this logic in benchmark_rx.py
>> >
>> > If no data received
>> > set freq to freq number 2
>> > else
>> > stay on the current freq
>> >
>> >
>> > Waiting for a response.
>> >
>> >
>> >
>> >
>> >
>> >
>> > --
>> > Umair
>> >
>> > _______________________________________________
>> > Discuss-gnuradio mailing list
>> > address@hidden
>> > http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>> >
>> >
>>
>> Hi,
>>
>> I've done this (not in benchmark_rx) by simply adding a timeout
>> (utilizing
>> wxpython see Timer) and a global variable that keeps track of which
>> frequency to switch to. If no data is received before the timeout, I
>> simply
>> switch to freq 2.
>>
>> Regards,
>> Dan
>> --
>> View this message in context:
>> http://www.nabble.com/Editing-benchmark_rx.py-for-spectrum-access-tp24528535p24785911.html
>> Sent from the GnuRadio mailing list archive at Nabble.com.
>>
>>
>>
>> _______________________________________________
>> Discuss-gnuradio mailing list
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
Hi,
Here's a short cut-out with the code I've used:
---------------------------------
class transceiver(gr.top_block):
def __init__(self, rx_callback):
gr.top_block.__init__(self)
self.usrp_decim = 16
u=usrp.source_c(0, self.usrp_decim)
self.rxpath=oqpsk_rx_graph(rx_callback,u)
self.connect(self.rxpath)
self.txpath=transmit_path()
self.connect(self.txpath)
class cs_mac(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(0, 0))
self.SenseTimer=wx.Timer(self, id=0)
self.Bind(wx.EVT_TIMER, self.OnSenseTimer, id=0)
def OnSenseTimer(self,event):
tb.rxpath.u.tune(tb.rxpath.subdev._which, tb.rxpath.subdev,
2405000000+(op.current_channel-11)*5000000)
class ieee_transceiver(wx.App):
def OnInit(self):
global tb
global frame
frame=cs_mac(None, -1, '')
tb=transceiver(frame.rx_callback)
frame.Show(False)
try:
tb.start()
except:
print "start except"
return True
if __name__ == '__main__':
try:
application=ieee_transceiver(0)
application.MainLoop()
except KeyboardInterrupt:
pass
--------------------
As you can see the timer will change rx-frequency on timeout. Hope this code
will be helpful even though it's poorly commented.
Regards,
Dan
--
View this message in context:
http://www.nabble.com/Editing-benchmark_rx.py-for-spectrum-access-tp24528535p24786838.html
Sent from the GnuRadio mailing list archive at Nabble.com.